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

How can javascript codes be hidden from old browsers that don't support javascript?

909


What is the disadvantage of javascript?

875


What is strict mode?

1120


Where is javascript used most?

877


Write a program in Java to display the IP address of the local and remote machine.

2139


What is enum data type?

880


What is a method in javascript?

950


Is everything in javascript asynchronous?

840


What is a currying function?

860


How do you target a specific frame from a hyperlink in javascript?

887


How to encode and decode a url in javascript?

993


What is null in js?

901


Can I learn javascript without knowing java?

849


How do I open a website code?

963


What is the difference between script type and the script language attributes?

910