【你敢说你懂JS吗】——JS测试

你感觉自己是JSer?来看看下面的测试……是男人就挨个琢磨,不许一顿滚动条!


  1. 1 && 3

  2. 1 && "foo" || 0

  3. 1 || "foo" && 0

  4. (1,2,3)

  5. x = {shift:[].shift};
    x.shift();
    x.length;

  6. {foo:1}[0]

  7. [true, false][+true, +false]

  8. ++'52'.split('')[0]

  9. a: b: c: d: e: f: g: 1, 2, 3, 4, 5;

  10. {a: 1, b: 2}[["b"]]

  11. "b" + 45

  12. {a:{b:2}}

  13. (function(){}())

  14. [1,2,3,4,5][0..toString.length]

  15. ({} + 'b' > {} + 'a')

  16. Number.prototype.x = function(){ return this === 123; };
    (123).x();

  17. Array(2).join()

  18. vars: var vars = vars;

  19. { foo = 123 }

  20. x = 1; (function(){return x; var x = 2;}())

  21. delete [].length;

  22. RegExp.prototype.toString = function() {return this.source};/3/-/2/;

  23. {break;4;}

  24. 'foo' == new function(){ return String('foo'); };

  25. 'foo'.split('') + []

原文地址:https://www.cnblogs.com/ccto/p/3013525.html