原文发布于我的github承接上篇44个 Javascript 变态题解析 (上)第23题[1 < 2 < 3, 3 < 2 < 1]这个题也还可以.这个题会让人误以为是2 > 1 && 2 < 3其实不是的.这个题等价于1 < 2 => true;
true < 3 => 1 < 3 => true;
3 < 2 => false;
false < 1 => 0 < 1 => true;答案是[true, true]第24题// the most classic wtf
2 == [[[2]]]这个题我是猜的. 我猜的true, 至于为什么.....both objects get converted to strings and in both cases the resulting string is "2"我不能信服...第25题3.toString()
3..toString()
3...toString()这个题也挺逗, 我做对了 :) 答案是error, '3', error你如果换一个写法就更费解了var a = 3;
a.toString()这个答案就是'3';为啥呢?因为在 js 中1.1,1.,.1都是合法的数字. 那么在解析3.
...
继续阅读
(27)