After the js list is generated, after reassigning a certain position:
let a=[]
for(let i=0;i<7;i++){
a.push('')
}
a[2]=4
There may be a strange phenomenon:
console.log printing is normal, but not normal after expansion:
the consequence is that when this list is assigned to other objects, the attached value is abnormal:
obj={
}
obj['a']=a
console.log(obj)
{
["",0,"","","","".""]}
The solution is to use JSON.stringify() and JSON.parse() to assign new data:
let b=JSON.stringify(a)
let c=JSON.parse(b)