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
What is dhtml in javascript?
How can I prevent others from reading/stealing my scripts or images?
How to have the status line update when the mouse goes over a link (the support of the status line is sporadic)?
What is differential inheritance?
How do you reverse a string in javascript?
what is flux in javascript?
Is array an object javascript?
What are the limitations of javascript?
Do you need to declare variables in javascript?
How to get complete current page url with javascript?
How Does Function Hoisting Work in JavaScript?
How to make elements invisible?
Can you explain about screen object?
What is the difference between the substr() and substring() functions in javascript?
What are different types of popup boxes available in javascript?