for (var i = 0; i < str.length; i++) {
console.log(str.charAt(i));
}
// for ... of ...
for (let char of "Hello") {
console.log(char);
}
// console result:
H
e
l
l
o
const str = "Hello Grepper!";
const chars = [...str];
chars.forEach((c, i) => console.log(c, i));
// for... in
for (let i in str) {
console.log(str[i]);
}