I am running this code:
const list = [1, 2, 3];
const flag1 = false;
const flag2 = true;
let selection = list[0]; // optimistic
if (flag1) {
selection = list[1];
} else if (flag2) {
selection = list[2];
}
and my ESLint is throwing this warning:
Use array destructuring. eslint(prefer-destructuring)
How can I solve this warning in a conditional assignment?