[譯]Javascript quiz

來源:互聯網
上載者:User

原文: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. function F(){print("Javascript is hard");}
    2. TypeError
    3. empty string
    4. [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啟動時掃描病毒
    6. 在Linux中列印出"bug就在上面的選項中"
 

提交 提交並將結果作為留言

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.