es map的用法

map的例子:

let arr =[
    {title:'aaaa',read:100,hot:true},
    {title:'bbbb',read:50,hot:false},
    {title:'ccc',read:100,hot:true}
 
    ];
 
  let newArr =arr.map((item,index,arr)=>{
    let json ={};
    json.t=`---${item.title}----------`;
    json.r =item.read+200;
    json.hot =item.hot ==true && '真棒';
 
    return json;
  })
  console.log(newArr)
原文地址:https://www.cnblogs.com/pengfei25/p/14518047.html