Erstellen Sie Array -JavaScript -Nummern
[...Array(5).keys()];
=> [0, 1, 2, 3, 4]
Gifted Gorilla
[...Array(5).keys()];
=> [0, 1, 2, 3, 4]
var foo = new Array(45); // create an empty array with length 45
for (i of range(1, 5)) {
console.log(i);
}
/* Output
* 1 2 3 4 5 */
[...range(1, 5)] // [1, 2, 3, 4, 5]
Array.from({length: 10}, (_, i) => i + 1)
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for(var i,a=[i=0];i<10;a[i++]=i);
const arr = [...Array(2)] // output [undefined, undefined]