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 flux in javascript?
What is the scope variable in javascript?
How can we detect os of the client machine using javascript?
If 2 methods have same name and same number of parameters, which one will be executed first?
How to select an element by id and swapping an image?
How do browsers work?
How many data types are there in javascript?
What javascript means?
What is escape() function?
Is javascript backend or frontend?
What is the reason for wrapping the entire content of a javascript source file in a function book?
What is the Infinity property used for in Javascript?
what is a difference of subclass and main class
What is null javascript?
What is the importance of javascript? Expalin