I have a for loop:
for (let i = 0; i < this.outputList.length; i++) {
this.outputList[i].checked = this.selectedOutputs.includes(i);
}
Is it posssible to replace this with an array.map? I want to set the 'checked' property of items in the outputList to true if it's index exists in the selectedOutputs array. I can't wrap my head around how this would look using a map function.
forloops whenever I can, but I think what you're doing currently is just fine..mapis when you want a new array based on a previous one. Since it doesn't seem you're iterating one array and producing another from it, then.mapis not a good choice.forEachfor this. But map isn't a good matchforEachimplementation there