How to Create Array in Javascript

18 Mar 2014, 11:08 AM

There are different ways to create array javascript.

 var myList = new Array();
 myList[0] = "item# 1";
 myList[1] = "item# 2";
 myList[2] = "item# 3";
 myList[3] = "item# 4";

 var myList = new Array("item# 1", "item# 2", "item# 3");

var myList = ["item# 1", "item# 2", "item# 3"];
 var myList = [];

 myList.push(100);
 myList.push(105);
 myList.push(108);

Related Contents

15 May 2014, 08:07 AM
C#, LINQ, List
15 May 2014, 07:54 AM
C#, LINQ, List
29 Apr 2014, 03:07 AM
C#, Generic
About
Explains how to create array in javascript

Date Posted 18 Mar 2014, 09:37 AM
Author Brainy Solutions
Views 768
;