How to explain the use of in statement?
For example, like below:
for(var b in coms) {
// code
}
How to explain the use of in statement?
For example, like below:
for(var b in coms) {
// code
}
“for (x in y)” is a for loop that iterates through the elements in y, where y is an array or other collection.
Thanks laurie! Seems a simple so.
It’s a shorter way of saying
for (var i = 0; i < coms.length; i++)
{
var b = coms[i];
//code
}