2011/05/18

Simple Lesson : For Each in Javascript

Hi friends, I have been write some script,which I must do "for each" in javascript. After I search in google, so I can find how to use for each in javascript.It's will be our simple lesson now.

If we can array element like this :
var carType = ["BMW","Mercedes Benz","Audi"];

We can to show all array value without worry about array length,do "for each" statement like this :

for(var iLoop in carType){
alert(carType[iLoop]);
}

No comments:

Post a Comment

Your Comment