Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

123
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda