How to loop over all string indexes in JavaScript

1 Answer

0 votes
const s = "javascript";

for (let i = 0; i < s.length; i++) {
    let ch = s.charAt(i);
    console.log(ch);
}



/*
run:

j
a
v
a
s
c
r
i
p
t

*/

 



answered Sep 17, 2020 by avibootz
...