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 enum in javascript?
Is javascript whitespace sensitive?
What is the prototype object in javascript and how it is used?
What is dom in javascript?
Is a parabola a function?
How to test a string as a literal and as an object ?
What's Prototypes for JavaScript
Why do we need javascript?
What is the difference between write and writeln in javascript?
What is closure? Give an example.
How to get height and width of different browser in Javascript?
How to display Alert in JavaScript