码迷,mamicode.com
首页 > Web开发 > 详细

js遇到这样基础题

时间:2015-07-09 00:32:28      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

连接url:http://perfectionkills.com/javascript-quiz

 

 

 

/* var a = (function() {
        return typeof arguments;
     })();
     alert(a); //Object
    
        var b = (function(x) {
            delete x;
            return x;
        })();
        alert(b); //undefined
    //**********************
    var f = function g() {
        return 23;
        typeof g();
    }
    alert(f); //function。。。。
    //********************************
    var y=1, x = y = typeof x;
    x;
    alert(x);//undefined
    alert(x = y = typeof x);//string
    //********************************
    var g = (function f(f) {
        return typeof f();
    })(function() {
        return 1;
    });
    alert(g); //number
    
    //**************************************
    var foo = {
    
        bar: function() {
            return this.baz;},
            baz: 1
    };
    var g = (function() {
        return typeof arguments[0]();
    })(foo.bar);
    alert(g); //undefined
        

    //****************    
  var foo = {
    bar: function(){ return this.baz; },
    baz: 1
  }
  alert(typeof (f = foo.bar)());

    //*********************************************
  var f = (function f(){ return "1"; }, function g(){ return 2; })();
  alert(typeof f); //number

  var x = 1;
  if (function f(){}) {
      
    x += typeof f;
    alert(x);
  }
  alert(x); //1number

  //alert(function g() {});
 
    //****************************************
    function f() {
        return f;
    }
    alert(new f() instanceof f); //false
    //*****************************************
    var g = (function f(){
    function f(){ return 1; }
    return f();
    function f(){ return 2; }
  })();

  alert(g); //2
  //********************************************
 
  var k = (function(foo){
    return typeof foo.bar;
  })({ foo: { bar: 1 } });
  alert(k); //undefined
    //******************************************
  var x = [typeof x, typeof y][1];
    alert(typeof typeof typeof x); //string
   //******************************************
     with (function(x, undefined){})
     alert(length); //2
      */

      var j = (function(x){
    delete x;
    return x;
  })(1);
  alert(j); //1

 

js遇到这样基础题

标签:

原文地址:http://www.cnblogs.com/double405/p/4631618.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!