一.数组的高阶方法
forEach(遍历)
var arr = ['我','和','我的','祖国'];
arr.forEach(function(item,index,self){...console.log(item,index,self);
})
map(映射)
var arr = [12,34,56];
var arr2 = arr.map(function(item,index...age:7},{
age:14}];
arr1.sort(function(a,b){
return a.age>b.age});
console.log(arr1);
三.箭头函数...箭头函数就是函数简写方式
组成: 参数 => 语句,
参数不是1个: (参数,参数2)=>语句
语句不止一条: 参数 =>{语句1;语句2;return 返回值}
返回的对象格式: 参数=>({对象}...,index,self);
})
转换为箭头函数
var arr = ['我','和','我的','祖国'];
arr.forEach(item => console.log(item))
四.函数的三种参数