Day 17:this 關鍵字 (3)
函數執行環境下 (Function Context) (續)
5. 顯性函數綁定之 call()/apply() 篇 (Explicit Function Binding for call()/apply())
console.log( Math.max.call(null, 40, 100, 1, 5, 25, 10) ); //100
console.log( Math.max.apply(null, [40, 100, 1, 5, 25, 10]) ); //1005.1. 和 bind() 的差別
5.2. 綁定物件範例 (一般模式 & 嚴謹模式)
5.3. 對已經被 Binding 過的函數物件無效
6. this 指向 new 所產生的新物件
this 指向 new 所產生的新物件References
Last updated
Was this helpful?