loop through elements in array javascript code example
Example 1: loop through array javascript
/* ES6 */
const cities = ["Chicago", "New York", "Los Angeles"];
cities.map(city => {
console.log(city)
})
Example 2: iterate through array javascript
foreach ($objects as $obj) {
echo $obj->property;
}