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

138
Views
How could I speed up the time of this code execution?

I wonder if there is a way to optimise the time that script takes to execute. I tried with yield but not sure if its a proper option to handle this case.

let enter = [1, 2, 3, 4, 5];

let result = 0;
let counter = 0;

while (counter < 3) {
  result++;
  if (result % enter[0] == 0) {
    counter++;
  }
  if (result % enter[1] == 0) {
    counter++;
  }
  if (result % enter[2] == 0) {
    counter++;
  }
  if (result % enter[3] == 0) {
    counter++;
  }
  if (result % enter[4] == 0) {
    counter++;
  }

  if (counter < 3) {
    counter = 0;
  }
}
console.log(result);
about 4 years ago · Juan Pablo Isaza
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!