5.5.7 for.. in Statement

The for … in statement is used to loop (iterate) through the elements of an array or through the properties of an object.  The code in the body of the for .. in loop is executed once for each element/property.


For(variable in object)
        Code to be executed


<script type = “text/javascript”>
Var x;
Var mycars = new Array();
My cars[0] =”Santro”;
My cars[1] =”Ford”;
My cars[2] =”Swift”;
For (x in mycars)


Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 1 = nine

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter