useful for game developers
`NaN === NaN` shouldn't return false
again useful for game developers
=== is `Object`
ES6 Object.is usefull but i hate how long it is
if (!Object.is) {
Object.is = function(x, y) {
// SameValue algorithm
if (x === y) { // Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
};
}
Choose one null value either `null` or `undefined`
DOM and UserLand use `null` to mean a null value while JavaScript uses `undefined` mostly to mean null, in strict and sloppy mode you can do `val == null` or `val != undefined`, but in strong mode you cant, I well aware that i can use default and rest parameters but i'm thinking beyond parameters, i'm thinking about unifying code APIs and undefined not being a keyword
we have `Date.now()` now but most `Date.now` polyfills i saw use +Date.now its just one line of code so no worries