I just noticed something interesting on most minification libraries.
This is a method from angular.js
function isNumber(value) {return typeof value === 'number';}
As you can see typeof value
value is on the left side of the comparison on the source code. But after minification it looks like this.
function Q(a){return"number"===typeof a}
Now the static member is at the left side of the comparison on angular.min.js minified code.
All cases of evaluated value === static
comparisons are converted to static === evaluated value
.
I just want to learn the reason of it. Is it better for reliability or performance or something else?