📜  js 数组填充图 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:48.090000             🧑  作者: Mango

代码示例1
let filledArray = new Array(10)
    .fill(null)
    .map(()=> ({'hello':'goodbye'}))

// In this approach, we are creating an array with ten empty slots, 
// then filling those slots with the null value, 
// then creating a new array with unique objects. 
// Now when we change an object in the array, 
// we are only changing a specific object, not a reference to an object.