Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is differential inheritance?

1008


What does e mean in a function?

1002


What are the different functional component in javascript?

961


How to count the number of element in an array using javascript?

1212


Difference between Client side JavaScript and Server side JavaScript?

1785


Can I learn javascript without html?

999


What is a nan value?

997


What web sites do you feel use javascript most effectively (i.e., Best-in-class examples)? The worst?

974


Explain javascript debounce function?

1093


What are local variables in javascript?

1013


Name the two functions that are used to create an HTML element dynamically?

972


Which built-in method sorts the elements of an array?

1074


Which built-in method reverses the order of the elements of an array?

987


How to access an external javascript file that is stored externally and not embedded?

1183


In a java script, what is the difference between "==" and "===" operator?

1119