ES6-for...of loop
HTML
<script src="https://cdn.jsdelivr.net/gh/eu81273/jsfiddle-console/console.js"></script>
JavaScript
console.log('***** Iterating over array ******');
let fruits = ['π', 'π', 'π', 'π', 'π', 'π', 'π'];
for (let fruit of fruits) {
console.log(fruit);
}
console.log('***** Iterating over string ******');
let name = 'Varun';
for (let ch of name) {
console.log(ch);
}