Categories
Latest
Popular

Javascript Arrays and usage

 

javascript arrays can be defined and implemented as

var array1=new Array();

array1[0]=”v1″;
array1[1]=”v2″;
array1[2]=”v3″;

initializing array

var array1=new Array(“v1″,”v2″,”v3″);

setting up values

var array1=["v1","v2","v3"];

display values

document.write(array1[0]);

result

v1

change values

array1[0]=”m1″;

testing

document.write(array1[0]);

result

m1