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
How can javascript codes be hidden from old browsers that don't support javascript?
What is the disadvantage of javascript?
What is strict mode?
Where is javascript used most?
Write a program in Java to display the IP address of the local and remote machine.
What is enum data type?
What is a method in javascript?
Is everything in javascript asynchronous?
What is a currying function?
How do you target a specific frame from a hyperlink in javascript?
How to encode and decode a url in javascript?
What is null in js?
Can I learn javascript without knowing java?
How do I open a website code?
What is the difference between script type and the script language attributes?