Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
stuck on looping user input ,someone kindly point me in the right direction
Post Body

a user inputs a value and i have to determine what happens everytime they click a button based on their input (value greater than 100 or less than 100.)Also how to remove the div wrapper when function makeRow ()is called?

<body> <div class="reset"> <button id="grid">Shake Etch A Sketch</button>
</div>

<script>
    let numOfSquares=5;

    let flexContainer= document.createElement('div');
    let btn =document.querySelector('#grid');
    let wrapper=document.createElement('div');
        wrapper.classList.add('wrapper');
    document.body.appendChild(flexContainer).className="flexContainer";

    function makeRow(grids){

        //a for loop within a for loop to create a grid
        for(let r=0;r<grids;r  ){
        let row=document.createElement('div');
       for(let c=0;c<grids;c  ){
            let gridbox=document.createElement('div');
            gridbox.classList.add('grid-box');
            gridbox.addEventListener('mouseover',()=>{
                gridbox.style.backgroundColor='aqua';
            });


            row.appendChild(gridbox);

        }
        wrapper.appendChild(row).className='grid-row';

    }
    flexContainer.appendChild(wrapper);
}
makeRow(numOfSquares);
btn.addEventListener('click',()=> {
    let userSquares =Number(prompt("enter number of squares per side less than 100"));

 if(userSquares<100){
     wrapper.remove();
     makeRow(userSquares);
 }else{
     do{
        userSquares =Number(prompt("enter number of squares per side less than 100"));
        }
        while(userSquares<100){
            makeRow(userSquares);
        }
        }
});

});

Author
User Disabled
Account Strength
0%
Disabled 1 year ago
Account Age
3 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,819
Link Karma
451
Comment Karma
1,268
Profile updated: 8 hours ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago