函数的调用 与 this

函数内部属性:

  [[call]]  [[caller]]

原始的理解 this:

1 function hell( thing ){
2   console.log( this + " say " + thing );  
3 }
4 
5 hello.call( "LiLei","hello" ); // LiLei say hello  (指向 LiLei)
6 hello( "hello" ); //say hello  (指向 window)
7 
8 es6 严格模式:
9     this undefined

 slice方法 copy 数组

var arr = [1,2,3,4,5];

var arrCopy = arr.slice();

arrCopy[0] = 10;

console.log(arr);  [1,2,3,4,5]

console.log(arrCopy); [10,2,3,4,5]

posted @ 2020-03-21 11:52  铁塔  阅读(132)  评论(0编辑  收藏  举报