Change the minified version of `undefined` to `1..u`
See original GitHub issueThis returns undefined
, and it’s two bytes shorter than void 0
(it’s also 5 bytes shorter than undefined
). The .
operator has a higher priority than the void
operator, so it’s safe. A plugin could also replace all instances of void 0
in other code with 1..u
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Why would my global variable be undefined in the minified ...
It's worth looking through the minified version for the declaration line. I suspect what is happening is that the minifier has ...
Read more >How To UnMinify JavaScript Minified Files Easily - YouTube
Sometimes you get a project with minified versions of JavaScript files being used in it, without source files. Minified version of files are ......
Read more >What is Minification | Why minify JS, HTML, CSS files - Imperva
Minification is the process of minimizing code and markup in your web pages and script files. It's one of the main methods used...
Read more >How to minify JavaScript - PageDart
When you minify your JavaScript you will improve your sites Page Speed. In this tutorial, we are going to look at how to...
Read more >Enable minify setting that time I got js errors on console
This means that some file does not agree with being minified. You can check more details when checking that error. ... The alternative...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Doesn’t seem like a good idea since everything would break if someone did
Object.prototype.u = 4
. We could hoist the definition with avar u = void 0;
at the top of the file if there are more than a couple references toundefined
though.A little brain-dump for @loganfsmyth’s hoisting suggestion…
Remember that
undefined
is the default value for a variable, so this could be shorter atvar u;
orlet u;
(although I guess it would be more robust to useconst u = void 0
)Also, there may be opportunities to piggy-back on a list of other variables declared, so could be as little as 2 additional characters. e.g. if
a
andb
are already defined in avar a,b;
declaration, then we only add,u
to getvar a,b,u;
Or, if you want to use
const
for robustness, you place theconst
immediately after an uninitialised variable declaration:var a,b;const u=a;