🔰destructuring iterable
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
JS ⟩ operator ⟩ assignment ⟩ destructuring ⟩ iterable
let [a, ...rest] = "abc" // rest = ['b', 'c']
for (const [i, value] of arr.entries()) { ... }
💾 程式:replit
// ⭐ works with any "iterable"
let [one, two, three] = new Set([1, 2, 3]); // 1, 2, 3
// ⭐ "rest" (array)
let [a, b, ...rest] =