How can I define an array in JavaScript?
Answers were Sorted based on User's Feedback
Answer / madhav arora
Arrays can be defined in following three ways :
1. regular method:
ex: var arrayname=new Array();
arrayname[0]="abc";
arrayname[1]="pqr";
arrayname[2]="xyz";
2.condensed method:
ex: var arrayname=new Array("abc","pqr","xyz");
3.literal method:
ex:var arrayname=["abc","pqr","xyz"];
Is This Answer Correct ? | 16 Yes | 4 No |
Answer / hiren b garasia
4.dense method:
ex: var days=new
Array('Mon','Tue','Wed','Thus','Fri','Sat','Sun');
Is This Answer Correct ? | 5 Yes | 4 No |
What is a method in javascript?
How can a page be forced to load another page in javascript?
What is the use of document object?
Explain “use strict” ?
What are a fixed-width table and its advantages in javascript?
What does double mean in javascript?
In a java script, what is the difference between "==" and "===" operator?
what is flux in javascript?
How do we add javascript onto a web page?
What boolean operators does JavaScript support?
5 Answers Aptech, HCL, Satyam,
How to remove duplicates from javascript array?
What is spread syntax?