Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda