Thursday, November 19, 2009

for in

18.  for in concepts is usefull for us no need to mention total number of array

One dimensional array

<  script type  =  "  text  /  javascript  "  >
var x;
var   no_list = new Array();
no_list [ 0 ] = "Saab";
no_list [ 1 ] = "Volvo";
no_list [ 2 ] = "BMW";

for (x in no_list)
  {
  document.write ( no_list [ x ]  +  " < br  / > " ) ;
  }
< / script >

Output:
Saab
Volvo
BMW

it will display all the name inside the no_list array.

No comments:

Post a Comment