JS-Add an identical attribute to each object in the array

New array: array;

Original array: list;

Add an attribute named aaaaa to the object of the original array list, the attribute value is '11111'

 

 let array=[];
    this.list.map((item,index)=>{
        array.push(
            Object.assign({},item,{'aaaaa','11111'})
        )
    })

Then print console.log (array); to see the required value

Published 248 original articles · Like 602 · Visit 1.08 million +

Guess you like

Origin blog.csdn.net/qq_32963841/article/details/103956768