+ 1

is there any foreach loop in javascript??

18th Dec 2016, 7:53 PM
manish rawat
manish rawat - avatar
6 ответов
+ 6
you can do something like this: var myList=[1,2,3,4,5,6,7] for(var num in myList){ document.write(num) }
18th Dec 2016, 9:08 PM
Burey
Burey - avatar
+ 4
array.forEach(function(){code;});
18th Dec 2016, 8:42 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
18th Dec 2016, 9:11 PM
Burey
Burey - avatar
0
how do we access any element of array here??
18th Dec 2016, 8:44 PM
manish rawat
manish rawat - avatar
0
like in python we take another variable which iterates over all elements
18th Dec 2016, 8:45 PM
manish rawat
manish rawat - avatar
0
thanks burey
18th Dec 2016, 9:10 PM
manish rawat
manish rawat - avatar