2๐
โ
- Looping through desserts
- spread each item with a new isActive property
- assign Boolean return value from the .includes method to isActive
sendData() {
let result = this.desserts.map((item) => ({ ...item, isActive: this.selected.includes(item) }));
console.log(result);
}
Source:stackexchange.com