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)

 

相关文章:

  • 2021-11-06
  • 2021-06-07
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2021-12-29
  • 2021-05-30
  • 2022-12-23
  • 2021-08-31
相关资源
相似解决方案