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

113
Views
Function containing a switch statement nested within a for loop. Takes integer and array. Trying to return number of iterations
/* 
Would take something like 
limesToCut(20, [large, small. large, medium, medium, small])
NEEDS TO STOP WHEN ENOUGH WEDGES ARE CUT AND RETURN 
NUMBER OF LIMES NEEDED
*/

export function limesToCut(wedgesNeeded, limes) {
  for (let i = 0; i < limes.length; i++) {
    switch (limes[i]) {
      case "small":
        wedgesNeeded = wedgesNeeded - 6;
        break;
      case "medium":
        wedgesNeeded = wedgesNeeded - 8;
        break;
      case "large":
        wedgesNeeded = wedgesNeeded - 10;
        break;
      default:
        wedgesNeeded = 0;
        break;
    }
  }

  return i;
}

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