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

90
Vistas
How to push new item to the existing array which will have a value subtracted 10 from previous item until it will reach close to 0 or 0?

I have one number which has a value of [200].

How to push new item to the existing array which will have a value subtracted 10 from previous item until it will reach close to 0 or 0?

I was thinking about while loop but not sure. Can anybody help to solve this please?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

A while loop will work fine:

const arr = [200]
while (arr[arr.length - 1] > 9) {
  arr.push(arr[arr.length - 1] - 10)
}
console.log(arr)
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