It is common to see this approach when we are creating a new array using map loop
const newArray = []
array.map((item) => {
newArray.push(item.value)
})
Right? but map loop already returns a array.
So we can do that instead
const newArray = array.map((item) => {
return item.value
})
Top comments (0)