for each loop javascript string character code example
Example 1: js for each character in string
for (var i = 0; i < str.length; i++) {
alert(str.charAt(i));
}
Example 2: loop on each character js
for (let c of target) console.log(c);
for (var i = 0; i < str.length; i++) {
alert(str.charAt(i));
}
for (let c of target) console.log(c);