1
Use Array.prototype.map()
to map the array into a new array.
Assuming this.item.specialties
is an array of objects, each containing an id
property, you would do this:
const ids = this.item.specialties.map(item => item.id)
Source:stackexchange.com