简体   繁体   中英

I have a question about javascript data processing

for example:

let array2 = [[{"Aaa":111}],[{"bbb":222}],[{"ccc":333}]];

I am a beginner, How can I turn it into?

[{"Aaa":111},{"bbb":222},{"ccc":333}]

You can try mapping it like this:

array2 = array2.map(i=>{
  return i[0]
})

You can make use of the javascript map function like this:

array2.map(x => x[0]);

Learn more about the map function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM