Foreach in Javascript
Written by Administrator   
venerd́, 22 febbraio 2008

Another function really useful PHP, missing in Javascript is foreach.

Here below a good example showing an associative array handling:

var array1 = new Array();

array1['value1']=10;
array1['value2']=20;
array1['value3']=30;

for (var vv in array1) {
document.write(vv + ' - ' + array1[vv] + '<br>');
}

Last Updated ( venerd́, 22 febbraio 2008 )