Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
some-1
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
some-1
14y ago
No, the correct way is to use the global function isNaN(x);
2.
▲
by
some-1
14y ago
See the following comment: http://news.ycombinator.com/item?id=4530557 The reason why some of them is so fast is because the constant expression is evaluated to a constant, so instead of doing a conversion in the test, the already convert
3.
▲
by
some-1
14y ago
-0+'12' (and 0+'12') doesn't convert it to a number, it converts the zero to a string and then concatenate them to the string "012". And Firefox optimize it: Function('return -0+"12"').toString(); Returns: "function anonymous() {
4.
▲
by
some-1
14y ago
The reason why the wicked is so fast in Firefox is because of the literal string and the optimizations done by the compiler. Try this (creates a function and then show the source): Function('return ~~(1 * "12");').toString(); And you