In javascript, for-of loop is used to get values of iterable objects. iterable objects can be array, map, strings etc.
Syntax
for (variable of iterable) {
// set of statements
}
Example
<script>
const number = [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
for (const num of number) {
document.write(num);
}
</script>
for-of loop Javascript with strings
<script>
let language = "Hello World from Javascript";
let characters = "";
for (let x of characters ) {
characters = characters + x;
}
</script>