Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Creating a table given the number of rows & columns from the user

I'm learning JavaScript at the moment , i was given a task to make a table with number of rows & columns given by the user.

I tried to do it using for loop but apparently I'm just making an infinite loop , I don't even know why it's infinite loop

function createTable(){
    let table = document.getElementById("myTable")
    let rows = window.prompt("Numbers of rows :")
    let columns = window.prompt("Numbers of columns :")
    for(let i = 1 ; i = parseInt(rows) ; i++){
        let myrow = document.createElement("tr")
        for(let ii = 1 ; ii = parseInt(columns) ; ii++){
            let mycol = document.createElement("td")
            mycol.textContent = "cell"
            myrow.innerHTML = mycol
        }
        table.append(myrow)
    }
}
<table id="myTable" border="1">
    </table>
    <form>
        <input type="button" onclick="createTable()" value="Create the table">
    </form>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!