zoukankan      html  css  js  c++  java
  • [转] 考验你的JavaScript底细

    http://sentsin.com/

    尽管今日的JavaScript已经突飞猛进,但JS的许多特性仍然保留,以下题目并不是有意设坑,许多地方将验证你的JS底细,如果错了一半,请别告诉我你从事前端。

    1. 1.
      (function(){
        return typeof arguments;
      })();
    2. 2.
      var f = function g(){ 
        return 23; 
      };
      typeof g();
      
    3. 3.
      (function(x){
        delete x;
        return x;
      })(1);
      
    4. 4.
      var y = 1, x = y = typeof x;
      x;
      
    5. 5.
      (function f(f){
        return typeof f();
      })(function(){ return 1; });
      
    6. 6.
      var foo = {
        bar: function() {
          return this.baz; 
        },
        baz: 1
      };
      (function(){
        return typeof arguments[0]();
      })(foo.bar);
      
    7. 7.
      var foo = {
        bar: function(){
          return this.baz; 
        },
        baz: 1
      }
      typeof (f = foo.bar)();
      
    8. 8.
      var f = (
        function f(){ 
          return "1"; 
        }, 
        function g(){ 
          return 2; 
        }
      )();
      typeof f;
      
    9. 9.
      var x = 1;
      if (function f(){}) {
        x += typeof f;
      }
      x;
      
    10. 10.
      var x = [typeof x, typeof y][1];
      typeof typeof x;
      
    11. 11.
      (function(foo){
        return typeof foo.bar;
      })({ foo: { bar: 1 } });
      
    12. 12.
      (function f(){
        function f(){ return 1; }
        return f();
        function f(){ return 2; }
      })();
      
    13. 13.
      function f(){ return f; }
      new f() instanceof f;
      
    14. 14.
      with (function(x, undefined){}) length;
      
    思考题:
    如何改变 undefined的typeof类型 ? (即 typeof undefined 或者 typeof(undefined) 都不为"undefined" )
    
  • 相关阅读:
    Python--列表、元组
    python之helloworld
    JMeter添加压力机、下载文件
    JMeter接口测试
    Postman接口测试
    浅谈接口测试
    poj3974 最长回文串 exkmp
    GDOI2014 beyond(D2T3) exkmp
    hdu4333 扩展KMP
    poj 3080 KMP
  • 原文地址:https://www.cnblogs.com/qiangxia/p/5441801.html
Copyright © 2011-2022 走看看