//
foreach implementation
foreach(arrayList,func)
{
var
i
=
0
;
try
{
for
(;i
<
arrayList;i
++
)
{
func(arrayList[i])
}
}
catch
(ex){}
delete
i;
return
;
}
//
example
var
arr
=
[
"
demo1
"
,
"
demo2
"
,
"
demo3
"
,
"
demo4
"
];
foreach(arr,
function
(item){
document.write(item + "<br />");
});
//screen result
demo1
demo2
demo3
demo4
//
foreach implementation
foreach(arrayList,func)
{
var i = 0 ;
try {
for (;i < arrayList;i ++ )
{
func(arrayList[i])
}
} catch (ex){}
delete i;
return ;
}
// example
var arr = [ " demo1 " , " demo2 " , " demo3 " , " demo4 " ];
foreach(arr, function (item){
document.write(item + "<br />");
});
foreach(arrayList,func)
{
var i = 0 ;
try {
for (;i < arrayList;i ++ )
{
func(arrayList[i])
}
} catch (ex){}
delete i;
return ;
}
// example
var arr = [ " demo1 " , " demo2 " , " demo3 " , " demo4 " ];
foreach(arr, function (item){
document.write(item + "<br />");
});
//screen result
demo1
demo2
demo3
demo4