Javascript creating a form or prompt to allow user to input the number of iterations


I need help with coding a form or prompt to allow user to input the number of iterations. I have included the code that I have so far, but its only for the forloop to print the integers 1-20. Prompt for challenge

function awesome() {
  append(myArray);
  append();
}

var myArray = []
for (var i = 1; i <= 20; i++) 
{
    if (i % 5 === 0 && i % 3 === 0) {
        console.log('Awesome');
    } else if (i % 3 === 0) {
        console.log("Awe");
    } else if (i % 5 === 0) {
        console.log("Some");
    } else {
        console.log(i);
    }
myArray.push(i);
}

Source: JavaSript – Stack Overflow

August 23, 2021
Category : News
Tags: javascript | prompt | user-input

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.