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

210
Vistas
How does one square an array of numbers using a FOR OF loop in javascript

I am trying to square an array of numbers so that each number prints out the number multiplied by itself.

ex:

const numbers = [1,3,4,5,6,7,8,9]

for (let numb of numbers) {
numb * numb;

console.log(numb)

I am not sure what I am doing wrong here. I am doing Colt Steele's web developer boot camp on Udemy and he doesn't explain his quizzes at all he just throws one at you with little to no explanation.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You are calculating the square of the number but you're not doing anything with it, you either have to store it into a variable or print it directly:

for (let numb of numbers) {
    const square = numb * numb;
    console.log(square)
}

or:

for (let numb of numbers) {
    console.log(numb * numb)
}
about 4 years ago · Santiago Trujillo 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