how can i create multiple paragraphs with javascript with shorter code?

I could not think of any other solution than using a for loop 😁 This definitely reduces the code by half length though.

numberOfParagraphs = 3
for(let i = 0; i< numberOfParagraphs;i++){
    var para= document.createElement("p");
    var i1 = document.createElement("input");
    var i2 = document.createElement("input");
<div id="div1"></div>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top