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

259
Views
Can some one explain the end of my fibonacci code?

I was creating fibonacci and my original return was "return (num - 1) + (num - 2)" but dont work, some one sugested to call the function "return fibonacci(num - 1) + fibonacci(num - 2)" and it worked, my question is why?

Code in anex

function fibonacci(num) {
    if (num < 2) {
        return num;

    } else {
        return fibonacci(num - 1) + fibonacci(num - 2)
    }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I see in the MDN, "The act of a function calling itself, recursion is used to solve problems that contain smaller sub-problems. A recursive function can receive two inputs: a base case (ends recursion) or a recursive case (resumes recursion)." Thanks for the pacience to explain Parag Diwan.

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!