I am getting this tslint error:
prefer-for-of Expected a 'for-of' loop instead of a 'for' loop with this simple iteration
code:
function collectItems(options) {
const selected = [];
for (let i = 0; i < options.length; i++) {
const each = options[i];
if (each.selected) {
selected.push(each.label);
}
}
return selected;
}
Can somebody help me to understand and resolve this error? I know there an answer on this question but that's not helping in my situation.