1. Node 安装
REPL:Loop(Print(Eval(Read))) 交互式代码运行终端
2. javascript 概览
- call 和apply
改变this 的值,call 接收参数列表,apply接收参数数组
function a(b,c){
console.log('this',this); // {a:'aaa'}
console.log('b', b); // bb
console.log('c', c); //cc
}
a.call({a:'aa'}, 'bb','cc')
a.apply({a:'aa'}, ['bb','cc'])
- bind
function a(){
return this.hello === 'world' // true
}
var b = a.bind({hello: 'world'})
b()