I have a map
below
map(x => ({
name: 'Name',
series: []
})),
that returns an Object {name: "Platform", series: Array(10)}
but what I need is an array [{name: "Platform", series: Array(10)}]
How would you do that?
There are two main ways you could approach that problem first being simply putting object into array and returning it the shortened way
map(x => [{
name: 'Name',
series: []
}]
)
and second being returning the array with a return statement in case you need some additional functionality in there
map(x => {
//additional functionality here
return [{
name: 'Name',
series: []
}]
})
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.