Home > front end >  Traverse the assignment, the god of logic
Traverse the assignment, the god of logic

Time:09-19

The first piece of code
Let arr=[' 1 ', '4', '55'], [], data=https://bbs.csdn.net/topics/item={}

Arr. ForEach (el=& gt; {
Item. The num=el
Data. Push (item)
})

The console. The log (data)//[{num: '55'}, {num: '55'}, {num: '55'}]


The second piece of code
Let arr=[' 1 ', '4', '55'], [], data=https://bbs.csdn.net/topics/item={}

Arr. ForEach (el=& gt; {
The item={
Num: el
}
Data. Push (item)
})
The console. The log (data)//[{num: '1'}, {num: '4'}, {num: '55'}]
  • Related