Ways of defining an Array in Javascript

vishalneeraj-24503
Posted by vishalneeraj-24503 under JavaScript category on | Points: 40 | Views : 804
There are many ways of defining an Arrays in Javascript:-

1). var employee1 = new Array(3); 
employee1[0] = "Vishal";
employee1[1] = "Kumar";
employee1[2] = "Neeraj";

2). var employee12 = ['Pune','Nagpur','Kanpur'];

3). var employee3 = [];
employee3.length = 3;
employee3[0] = "Dot Net";

4). var employee4 = [,,,,]; //This will initialize the length property to 4.
employee4[0] = "Vishal"; //Output will be Vishal,,,

Comments or Responses

Posted by: t5j9033387989 on: 12/20/2013 Level:Starter | Status: [Member] | Points: 10
thanks....for posting

Login to post response