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

95
Visualizações
how to make 10PRINT in javascript

I'm trying to make 10PRINT in javascript but I'm getting an out-of-memory error. it's supposed to output something like this: ///////\///\///\////////\\/\\///\\///
here is the code:

let st = []
let i = 0
let i2 = 0
while(i < 10)
{
    while(i2 < 10)
    {
        if(Math.random() > 0.5)
        {
            st.push("/")
        }else
        {
            st.push("  ⃥")
        }
    }
    i2 = 0
    console.log(st)
    st = {}
}

can somebody tell me why it's not working?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As Sebastian Simon stated, i and i2 are never modified in the loops, so they will never reach 10, thus making the program run till the end of time (or end of memory, in your case).

I suggest replacing the whiles with for loops, assuming i and i2 need to be incremented sequentially.

about 4 years ago · Juan Pablo Isaza Relatório
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