I have adapted to my needs the Unicode shortcuts method by @bebe.
The problem which many have faced with the original solution is due to the fact that some of the functions/properties belong to a class prototype while others to a class itself. These need to be handled separately.
The minified code now takes 132 bytes:
[Number,S=String,Array].map(r=>{f=(r=>Object.getOwnPropertyNames(r).map((e,t)=>r[S.fromCharCode(t+248)]=r[e])),f(r),f(r.prototype)})
Of course, you can drop Number and Array if unused from the initial array to save a couple of bytes. String is used in the code itself so removing it doesn't help a lot.
Part of the problems came from Math having no protype thus requiring its special handling. Besides the name in the initial array it also takes another 5 bytes to skip prototype handing. So use the variant below only if you need Math:
[Number,S=String,Array,Math].map(r=>{f=(r=>Object.getOwnPropertyNames(r).map((e,t)=>r[S.fromCharCode(t+248)]=r[e])),f(r),r.E||f(r.prototype)})
I use the same code for Node.js (v12.19.0) and Chrome (90.0.4430.212 x64).
Code Char Number Number.prototype String String.prototype Array Array.prototype Math
248 ø length constructor length length length length abs
249 ù name toExponential name constructor name constructor acos
250 ú prototype toFixed prototype anchor prototype concat acosh
251 û isFinite toPrecision fromCharCode big isArray copyWithin asin
252 ü isInteger toString fromCodePoint blink from fill asinh
253 ý isNaN valueOf raw bold of find atan
254 þ isSafeInteger toLocaleString charAt findIndex atanh
255 ÿ parseFloat charCodeAt lastIndexOf atan2
256 Ā parseInt codePointAt pop ceil
257 ā MAX_VALUE concat push cbrt
258 Ă MIN_VALUE endsWith reverse expm1
259 ă NaN fontcolor shift clz32
260 Ą NEGATIVE_INFINITY fontsize unshift cos
261 ą POSITIVE_INFINITY fixed slice cosh
262 Ć MAX_SAFE_INTEGER includes sort exp
263 ć MIN_SAFE_INTEGER indexOf splice floor
264 Ĉ EPSILON italics includes fround
265 ĉ lastIndexOf indexOf hypot
266 Ċ link join imul
267 ċ localeCompare keys log
268 Č match entries log1p
269 č matchAll values log2
270 Ď normalize forEach log10
271 ď padEnd filter max
272 Đ padStart flat min
273 đ repeat flatMap pow
274 Ē replace map random
275 ē search every round
276 Ĕ slice some sign
277 ĕ small reduce sin
278 Ė split reduceRight sinh
279 ė strike toLocaleString sqrt
280 Ę sub toString tan
281 ę substr tanh
282 Ě substring trunc
283 ě sup E
284 Ĝ startsWith LN10
285 ĝ toString LN2
286 Ğ trim LOG10E
287 ğ trimStart LOG2E
288 Ġ trimLeft PI
289 ġ trimEnd SQRT1_2
290 Ģ trimRight SQRT2
291 ģ toLocaleLowerCase
292 Ĥ toLocaleUpperCase
293 ĥ toLowerCase
294 Ħ toUpperCase
295 ħ valueOf
296 Ĩ replaceAll (*)
Notes:
replaceAll (marked with an asterisk) exists only for Chrome.
Some comments where criticizing the usage of non-standard alphabet. If you manage to find another consistent range of Unicode characters that can be used as property names in JS then feel free to improve this answer. I couldn't find better than the original.
var
)? And should JavaScript golf code be a function or output something directly? I honestly think this can make much difference. \$\endgroup\$(class{static #x = 1;get #y(){};set #y(z){}})
can be rewritten as(class{static#x = 1;get#y(){};set#y(z){}})
. This makes for some nice obfuscation, too, but I can’t think of a practical example in code golf. \$\endgroup\$