Создайте массив JavaScript
[...Array(10).keys()]
//=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Gorgeous Goosander
[...Array(10).keys()]
//=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Array.from(Array(10).keys())
//=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
//create an array like so:
var colors = ["red","blue","green"];
//you can loop through an array like this:
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
const array1 = ["eat", "sleep"];
var events = [
{
userId: 1,
place: "Wormholes Allow Information to Escape Black Holes",
name: "Check out this recent discovery about workholes",
date: "2020-06-26T17:58:57.776Z",
id: 1
},
{
userId: 1,
place: "Wormholes Allow Information to Escape Black Holes",
name: "Check out this recent discovery about workholes",
date: "2020-06-26T17:58:57.776Z",
id: 2
},
{
userId: 1,
place: "Wormholes Allow Information to Escape Black Holes",
name: "Check out this recent discovery about workholes",
date: "2020-06-26T17:58:57.776Z",
id: 3
}
];
console.log(events[0].place);
const products=["watch", "pc", "mouse", "keyboard"];