I have a questions about nested functions
How can I get b array which contains [1, 2, 3] here:
function someFunc() {
const a = [{
id: 1
}, {
id: 2
}, {
id: 3
}]
const b = []
function someOtherFunc() {
a.forEach(i => {
b.push(i.id)
})
}
return b
}
console.log(someFunc())
someOtherFuncanywhere...