This article has a few problems. * "All of the above does the same job...". Not true at all; the four examples do three very different things. Try them with a more interesting string argument, say '012.78': parseInt('012.78') // 10 (number interpreted as octal integer) Number('012.78') // 12.78 +'012.78' // 12.78 ~~(1*'012.78') // 12 * "...and n1==n2==n3==n4" Using == instead of === here makes the statement meaningle…
In general, using operators will speed things up as these can be statically dispatched. No idea why +'12' is so slow, though - 0+'12' doesn't suffer from this...
Function('return -0+"12"').toString();
Returns: "function anonymous() { return "012";}"
So there is no conversion going on in the test, it just returns the string "012". No wonder that it is fast. See my comment above for another jsperf where it is converted in each test.