const scores =[ 80, 90, 40, 70];
const [ a, b, ...others] = scores;
console.log(a);
console.log(b);
console.log(others);
このコードで ...others の部分の 40 と 70 は score からきていると思うのですが、
定数 others に scores の 40 と 70 が代入されたという認識で間違いないですか?
その場合、
const [ a, b, ...others, c] = scores; ☜「c」を追加
console.log(a);
console.log(b);
console.log(others);
console.log(c); とした場合、othersに 40、c に 70 が代入されると思ったのですが、エラーになります。
認識が間違っていますか?それとも、...に特別な理由があったりしますか?
この回答を見るにはプレミアムプランへの登録が必要です
プレミアムプランとは?