原文:http://asenbozhilov.com/articles/quiz.html


这些题目都源自ECMA-262-3规范.Good luck!

译者注:作者是根据ES3出的题,但我没发现和ES5有不同表现的地方.暂时不给出答案解释.请到http://ecma-international.org/ecma-262/5.1/找答案

 

  1. Function.prototype.toString.call({
    name: 'F',
    body: 'print("Javascript is hard")'
    });
    1. TypeError
    2. empty string
    3. [object Function]
  2. new String({
    toString : function (){ return this;},
    valueOf : function () {return this;}
    });
    1. TypeError
    2. String value
    3. String object
    4. Object
  3. typeof (new Date() + new Date());
    1. number
    2. object
    3. string
    4. undefined
  4. typeof (void null);
    1. object
    2. null
    3. undefined
    4. SyntaxError
  5. function F() {}
    F.prototype = new Function;
    Object.prototype.toString.call(new F());
    1. [object Function]
    2. [object Array]
    3. [object String]
    4. [object Object]
  6. [].length = -2;
    1. TypeError
    2. -2
    3. RangeError
    4. 0
  7. var D = Math.pow(2, 33);
    (D | D) == D;
    1. true
    2. false
    3. RangeError
  8. '_string_'.replace(/^/, "$'");
    1. _string_
    2. '_string_
    3. $'_string_
    4. _string__string_
  9. eval('typeof F; function F() {}'); 
    1. undefined
    2. object
    3. string
    4. function
  10. debugger; 
    1. 给微软寄钱
    2. 可能会SyntaxError
    3. 把你的源代码通过电子邮件发送给Brendan Eich
    4. ReferenceError
    5. 在Windows启动时扫描病毒
 

相关文章: