How can I define an array in JavaScript?
Answer Posted / 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 |
Post New Answer View All Answers
Is javascript case sensitive language?
What are global variables in javascript?
What is the difference between script type and the script language attributes?
How do I save javascript?
What is the default scope in javascript?
How do I open a website code?
What are different types of popup boxes available in javascript?
How do you write an if statement in javascript?
What is the difference between sessionstate and viewstate?
Which javascript is best?
How to write a hello world example of javascript?
What does double mean in javascript?
What is the main difference between Map collections and other collections such as Set.
What is npm javascript?
How can I set up my own javascript error handler?