javascrip arrays 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)
// 2

Example 3: array javascript

var familly = []; //no familly :(
var familly = new Array() // uncommon
var familly = [Talel, Wafa, Eline, True, 4];
console.log(familly[0]) //Talel
familly[0] + "<3" + familly[1] //Talel <3 Wafa
familly[3] = "Amir"; //New coming member in the family

Example 4: what are the two ways to create an array in javascript examples?

let scores = new Array(9,10,8,7,6);

Tags:

Java Example