4 ms·
so use the more common for(let v of list) { console.log("foo"); } If you're saying that "initialize an array with a defined length" should be "initialize an e
by oceanswave 10y ago
so use the more common
for(let v of list) { console.log("foo"); }
If you're saying that "initialize an array with a defined length" should be "initialize an empty array of 5 values of undefined" then yeah, but you can also use:
let list = Array.from(Array(5));
as new Array(5) creates an array of length 5, but each is a "hole"
I know the syntax is similar to C# or other languages, but because it's slightly different doesn't mean it doesn't bring anything to the table. JS or TS != C# in a browser the syntax is similar...