- 声明变量必须加关键字(var)
- 不允许参数名重复
- 没有明确隶属对象的函数中的this(执行了)指向undefined
- arguments的内容不会被形参的改变而影响
- arguments.callee被禁止使用
- 严格模式开启方式:在作用域之前加上use strict
- forEach(遍历)
语法:array.forEach(function(currentValue,index,arr))
- map(遍历)
语法:array.map(function(currentvalue,index,map))
- some
语法:array.some(function(currentValue,index,arr))
- every
语法:array.every(function(currentvalue,index,arr))
- reduce
语法:array.reduce(function(previous,current,index,arr))
- filter
语法:array.filter(function(currenValue,index,arr))
- bind
var obj = {
name:'jack'
}
var name ="tom"
function sayHello(){
console.log(this.name);
}
sayHello()
var bindFuntion = sayHello.bind(obj)
- call
- apply
var obj = {
name:'jack'
}
var name ='tom'
function sayHello(){
console.log(this.name);
}
sayHello()
sayHello.apply(obj,null)
sayHello.call(obj,null)