Can I avoid declaring a useless variable when array destructuring when I am only interested in array values beyond index 0?
In the following, I want to avoid declaring a
, I am only interested in index 1 and beyond.
// How can I avoid declaring "a"?
const [a, b, ...rest] = [1, 2, 3, 4, 5];
console.log(a, b, rest);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…