Say you have an array-like Javascript ES6 Iterable that you know in advance will be finite in length, what\'s the best way to convert that to a Javascript Array?
The
You can use Array.from or the spread operator.
Example:
let x = new Set([ 1, 2, 3, 4 ]); let y = Array.from(x); console.log(y); // = [ 1, 2, 3, 4 ] let z = [ ...x ]; console.log(z); // = [ 1, 2, 3, 4 ]