I face the problem and I hope they will help me here with advice.
There is an array of objects. (urlParams.categories)
I want to output using the extension operator (...) not all of these objects in their entirety, but the specific value of these objects by key (id). i.e.: 1, 2, 3, 4, and so on
I can do this using "for in" or "forEach", but I'm want to know if it can be done with (...)
I tried to do it like this:
let urlParams = {
'categories': [
{ id: '1', name: 'Test' },
{ id: '2', name: 'Test' },
{ id: '3', name: 'Test' },
{ id: '4', name: 'Test' }
]
}
console.log(urlParams.categories)
console.log(...urlParams.categories.id)