vue loop through HTMLcollection code example
Example 1: javascript loop over classlist
var myElements = document.getElementsByClassName("some_class_name");
for(var i = 0; i < myElements.length; i++){
console.log(myElements[i]);
}
Example 2: react loop through array
this.items = this.state.cart.map((item, key) => <li key={item.id}>{item.name}</li>);
Example 3: php loop through obect
PHP By Wandering Weevil on Mar 8 2020
$person = new StdClass();
$person->name = "Ngbokoli";
$person->age = 31;
$person->nationnality = "Congolese";
$person->profession = "Student";
foreach ($person as $key => $value) {
echo $key." ".$value."\n";
}