Skip to content

Instantly share code, notes, and snippets.

@drnugent
Last active July 4, 2016 08:21
Show Gist options
  • Save drnugent/a7e99cd3b27580c6211e to your computer and use it in GitHub Desktop.
Save drnugent/a7e99cd3b27580c6211e to your computer and use it in GitHub Desktop.
@getify MIN_VALUE exmple
[] == ![]; //true
function foo() {
try {
return 2;
}
finally {
return 3;
}
}
foo(); // 3 <— wtf? where’s the 2?
Number.MAX_VALUE > 0; //true
Number.MIN_VALUE < 0; //false
Number({}); // NaN
Number([]); // 0
o1 = { hello: “world” };
o2 = Object.create(null);
o2.hello = “world”;
o1 + “”; // “[object Object]”
o2 + “”; // TypeError!
s = Symbol(“that’s cool”);
s; // Symbol(that’s cool)
String(s); // "Symbol(that’s cool)”
s + “”; // TypeError!
{
typeof a; // undefined
typeof b; // TDZ error!
// …
let b;
}
42.toFixed(2); // Syntax Error
42. toFixed(2); // Syntax Error
42 .toFixed(2); // “42.00”
42 . toFixed(2); // “42.00”
42.0.toFixed(2); // “42.00”
42..toFixed(2); // “42.00”
Number(“0.”); // 0
Number(“.0”); // 0
Number(“.”); // NaN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment