Last active
July 28, 2016 06:46
-
-
Save calzoneman/f448cd31ecb0bb12423b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[100, 10, 5, 1].sort() // -> [1, 10, 100, 5] | |
parseInt(0.0000007) // -> 7 | |
parseInt('0.0000007') === parseInt('1e-7'); // -> false | |
[1, 2, 3, 4, 5].map(parseInt) // -> [1, NaN, NaN, NaN, NaN] | |
x = null | |
typeof x === 'object' // -> true | |
new String('abc') === String('abc') // -> false | |
new String('abc') === 'abc' // -> false | |
if (new Boolean(false)) { | |
console.log('The universe has imploded'); | |
} else { | |
console.log('Everything is fine (for now)') | |
} // -> The universe has imploded | |
var pentagram = '⛤'; | |
pentagram.length // -> 1 | |
var smile = '😀'; | |
smile.length // -> 2 | |
var array = new Array(10); | |
array[7] = 'foo'; | |
console.log(array.map(function () { return 'bar'; })); // -> [ , , , , , , , 'bar', , ] | |
[] + [] // -> '' | |
{} + {} // -> '[object Object][object Object]' | |
[] + {} // -> '[object Object]' | |
{} + [] // -> 0 | |
'' * 11 // -> 0 | |
null == undefined // -> true | |
null === undefined // -> false | |
void 0 // -> undefined | |
Math.pow(NaN, 0) // -> 1 | |
Math.pow({}, []) // -> 1 | |
typeof [1, 2, 3] // -> 'object' | |
'10' + '7' // -> '107' | |
'10' - '7' // -> 3 | |
'10' * '7' // -> 70 | |
{ 0.0000001: true, '1e-7': false } // -> { '1e-7': false } | |
var r = /a/g; console.log(r.test("abc"), r.test("abc")); // true false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment