Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Statements</h1>
<h2>The for...of Loop</h2>
<p>Iterate (loop) over the characters of a string:</p>
<p id="demo"></p>
<script>
let text1 = "JavaScript";
let text2 = "";
for (let x of text1) {
  text2 += x + " ";
}
document.getElementById("demo").innerHTML = text1 + "<br>" + text2;
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_state_forof2 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:13 GMT -->
</html>