declare javascript array code example
Example 1: javascript declare array
var array = []
Example 2: how to create an array in javascript
let fruits = ['Apple', 'Banana']
console.log(fruits.length)
Example 3: javascript array read object value in array
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);
Example 4: how to create array in javascript
let array_1 = new Array(2);
arr.push("James");
arr.push("Fred");
let array_2 = ["James", "Fred"];
Example 5: how to declare an array
redim Friday(NumFRdays)