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 |
How to add html elements dynamically with JavaScript?
Can I learn javascript without html?
What is the most widely used programming language?
How to define a named function in JavScript?
What is an asynchronous programming? Why is it important in javascript?
What Does JavaScript Void(0) Mean?
How much time it will take to learn javascript?
Entire content of a JavaScript source file in a function block?
What does clean white space mean?
What is a function constructor?
What is enum in javascript?
What are the valid scopes of a variable in JavaScript?