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

92
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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