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

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

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