js for loop elements code example
Example 1: javascript loop and array
var array = ["hello","world"];
array.forEach(item=>{
console.log(item);
});
Example 2: how to loop over dom objects javascript
Array.from($('.'+$( this ).attr('id'))).forEach(function(obj){
console.log(obj);
});