Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!