[譯]Javascript quiz


原文: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")'
    });
  2. new String({
    toString : function (){ return this;},
    valueOf : function () {return this;}
    });
  3. typeof (new Date() + new Date());
  4. typeof (void null);
  5. function F() {}
    F.prototype = new Function;
    Object.prototype.toString.call(new F());
  6. [].length = -2;
  7. var D = Math.pow(2, 33);
    (D | D) == D;
  8. '_string_'.replace(/^/, "$'");
  9. eval('typeof F; function F() {}'); 
  10. debugger; 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM