function createData() {
// 如果不 fill 循环默认会跳过空值
return new Array(1000).fill(null).map((v, i) =>
({ name: `name${i + 1}` })
);
}
function Cra(){
return new Array(1000).fill(null).map((v,i)=>{
return {name:`name${i+1}`}
})
}
function mapreturn(){
return new Array(1000).fill(null).map((v,i) => (
{name:`name${i+1}`}
)
)
}
// console.log(mapreturn());
//
// const data = createData();
// console.log(data);
console.log(Cra());
标签:map,return,name,console,JS,返回值,null,fill
From: https://www.cnblogs.com/freddyhuang/p/16787585.html