JSFiddle - React, Tailwind, and code Playground

by Andrew Gerst

HTML

DOM Manipulation and Statement Label

JavaScript

loop: for (x=0; x<6; x++) {
    var newParagraph1 = document.createElement("p");
    var newText1 = document.createTextNode("The value of x is : " +x);
    newParagraph1.appendChild(newText1);
    document.body.appendChild(newParagraph1);
    if (x==3) {
        break loop;
    }
}

var newParagraph1 = document.createElement("p");
var newText1 = document.createTextNode("The last value of x is : " +x);
newParagraph1.appendChild(newText1);
document.body.appendChild(newParagraph1);