# Built-in string iterators in JavaScript

Strings also have a built-in iterator. Let's for example loop through the characters of a string:

`for (let elem of 'abc') { console.log(elem); // 'a', 'b', 'c' }`

And now let's expand the string through the `spread` operator:

`console.log([...'abc']); // ['a', 'b', 'c']`

Given a string with a number:

`let str = '12345';`

Loop through the digits of this number and find their sum.

← →
↑
en ru