// Don't need to provide elements directly, but you can// FIRST OPTIONvar myArray =newArray(/*elements1, elements2*/);// SECOND OPTIONvar mySecondArray =[/*element1, element2*/];
// 'fruits' array created using array literal notation.const fruits =['Apple','Banana'];console.log(fruits.length);// 2// 'fruits2' array created using the Array() constructor.const fruits2 =newArray('Apple','Banana');console.log(fruits2.length);// 2// 'fruits3' array created using String.prototype.split().const fruits3 ='Apple, Banana'.split(', ');console.log(fruits3.length);// 2
var array =[item1, item2,.....];/*
item1 and item2 could be a string (which is
a letter written in double or single quotes like this "string" or 'string') or
a number (which is just a normal number on the keypad) or a boolean (which is
an experssion which either returns to true of false) and the ..... means that
the inputs can be infinite.
*/