JavaScript this运用

1.this

  1. 函数预编译过程 this —> window

    函数预编译中this --> window ,当new 一个对象是 函数内的this 改变指向,
    
    this --> 新建的对象 

     

  2. this --> 新建的对象

  3. 全局作用域里 this—> window

  4. call/apply 可以改变函数运行时this 指向

  5. obj.func(); func()里面的this指向obj;

谁调用this 指向 谁;

2.arguments

两个属性

  1. callee

作用:指向函数的引用

注意:谁调用就指向谁

返回结果分别为test ,demo 的指向。

  1. length

  数组长度

posted @ 2017-10-12 23:28  im.lhc  阅读(75)  评论(0编辑  收藏  举报