this

                                  /*this,笔试真题讲解(上)*/
    //例题1:下面这段js代码执行完毕后x,y,z的值分别是多少? [00:42 --> 02:53]
    // var x = 1,
    //     y = z = 0;
    
    // function add(n) {
    //     return n = n + 1;            
    // }

    // y = add(x);

    // function add(n) {
    //     return n = n + 3;
    // }
    // z = add(x);


    //例题2:下面代码中console.log()的结果是{1,2,3,4,5}的选项是 [02:53 --> 09:33]
    //A
    // function foo(x) {
    //     console.log(arguments);
    //     return x
    // }
    // foo(1, 2, 3, 4, 5)

    //B
    // function foo(x) {
    //     console.log(arguments);
    //     return x
    // }(1, 2, 3, 4, 5)

    //C
    // (function foo(x) {
    //     console.log(arguments);
    //     return x
    // })(1, 2, 3, 4, 5);  

    //D
    // function foo() {bar.apply(null, arguments)}
    // function bar(x) {console.log(arguments)}
    // foo(1, 2, 3, 4, 5);


    //例题3: 我是一行文本,需要水平和垂直居中 [11:30]
    // text-align


    //例题4:请问以下表达是式的结果是什么? [12:12 --> 20:56]
    // parseInt(3,8)
    // parseInt(3,2)
    // parseInt(3,0)

    //A 
    // 3 3 3

    //B
    // 3 3 NaN

    //C
    // 3 NaN NaN
    
    //D
    // other


    //例题5:以下那些是JavaScript语言typeof可能返回的结果 [20:56 --> 25:46]
    
    // string

    // array

    // object

    // null


    //例题6:看看下面alert的结果是什么 [26:07 --> 28:42]
    // function b(x, y, a) {
    //     arguments[2] = 10;
    //     alert(a);
    // }
    // b(1, 2, 3);
    //如果把函数体改成下面,结果又是什么?
    // a = 10;
    // alert(arguments[2]);


    //例题7:  [29:34 --> 32:58]
    // var f = (
    //     function f() {
    //         return "1";
    //     },

    //     function g() {
    //         return "2";
    //     }
    // )();
    // typeof f;


    //例题8:写出下来程序的执行结果 [32:58 --> 39:00]
    // var x = 1;
    // if(function f() {}) {

    //     x += typeof f;

    // }

    // console.log(x);


    //例题9:以下那些表达式的结果为true() [39:00 --> 47:59]
    // A、undefined == null
    // B、undefined === null
    // C、isNaN('100')
    // D、parseInt("la") == 1


                          /*this*/ //[48:00 --> 54:16]
    /*
    1.函数预编译过程 this --> window

    2.全局作用域this --> window

    3.call/apply可以改变this运行时this的指向

    4.obj.function(){}; function(){}[里面的this指向obj]
    */

                   /*this,笔试真题讲解(下)*/
    //例题10:请写出代码的输出结果 [55:00 --> 下节06:07]
    // var name = "222";

    // var a = {

    //     name : "111",

    //     say : function () {
            
    //         console.lnfo(this.name);
    //     }
    // }
    // var fun = a.say;
    // fun();
    // a.say();
    // var b = {
    //     name = "333",
    //     say : function (fun) {
            
    //     }
    // }
    // b.say(a.say)
    // b.say = a.say
    // b.say();


    /*arguments.callee
    
      function () {}.caller

      
    */
    

    //.callee意思是打印函数的引用[11:17 --> 15:50]
    // function test() {
    //     console.log(arguments.callee)
    // }
    // test()

    // var num = (function (n) {
    //     if(n == 1) {
    //         return 1;
    //     }
    //     return n * arguments.callee(n - 1)
    // }(10))

    //例题callee:[15:58 --> 16:51]  
    // function test() {
    //     console.log(arguments.callee);
    //     function demo() {
    //         console.log(arguments.callee);
    //     }
    //     demo();
    // }
    // test();


    //function.caller      [16:51 --> 18:27]


    //例题11:请阅读以下代码,写出以下程序的执行结果: [19:10 --> 25:36]
    // var foo = '123';
    // function print(params) {
    //     var foo = '456';
    //     this.foo = '789';
    //     console.log(foo);
    // }
    // print();

    // var foo = 123;
    // function print() {
    //     this.foo = 234;
    //     console.log(foo);
    // }
    // print();


    //例题12:运行test()和nuw test()的结果分别是什么 [25:46 --> 31:20]
    // var a = 5;
    // function test(params) {
    //     a = 0;
    //     alert(a);
    //     alert(this.a);
    //     var a;
    //     alert(a);
    // }
    // new test()


    //例题13:请阅读以下代码,写出以下程序的执行结果; [31:45 --> 33:00]
    // function print() {
    //     console.log(foo);
    //     var foo = 2;
    //     console.log(foo);
    //     console.log(hello);
    // }
    // print();


    //例题14:请阅读以下代码,写出以下程序的执行结果;[33:01 --> 34:27]
    //  function print() {
    //      var test;
    //      test();
    //      function test() {
    //          console.log(1);
    //      }
    //  }
    //  print()


    //例题14:请阅读以下代码,写出以下程序的执行结果;[34:27 --> 34:48]
    // function print() {
    //     var x = 1;
    //     if(x == "1")
    //     console.log("One!");
    //     if(x === "1")
    //     console.log("Two!");
    // }
    // print();


    //例题14:请阅读以下代码,写出以下程序的执行结果;[34:48 --> 39:06]
    // function print() {
    //     var marty = {
    //         name : "marty",
    //         printName :function () {
    //             console.log(this.name);
    //         }
    //     }
    //     var test1 = {
    //         name : "test1"
    //     };
    //     var test2 = {
    //         name : "test2"
    //     };
    //     var test3 = {
    //         namr : "test3"
    //     };
    //     test3.printName = marty.printName;
    //     var printName2 = marty.printName.bind({name : 123})
    //     marty.printName.call(test1);
    //     marty.printName.apply(test2);
    //     marty.printName();
    //     printName2();
    //     test3.printName();
    // }
    // print();


    //例题15:请阅读以下代码,写出以下程序的执行结果; [39:11 --> 44:50 ]
    //  var bar = {
    //      a : "002",
    //  }
    //  function print() {
    //      bar.a = 'a';
    //      Object.prototype.b = 'b';
    //      return function inner() {
    //          console.log(bar.a);
    //          console.log(bar.b);
    //      }
    //  }
    //  print()();



   











    
    
    
</script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值