Suppose you have the following array:
const arr = [
{'stars': 5},
{'stars': 4},
{'stars':5}
]
How would one go about extracting all the integers from the 'stars' keys, and pushing them into an array?
I've tried the following
arr.map(item => {
let arr = []
arr.push(...arr,item.stars)
console.log(arr)
})
...but it just pushes each number into it's own array, as follows:
[5] [4] [5]
What is I want is an array that looks like this: [5,4,5]
Suggestions?