fibonacci recursive solution

PHOTO EMBED

Mon May 23 2022 23:09:54 GMT+0000 (Coordinated Universal Time)

Saved by @joeclaap #javascript #fibonacci #recursion #algorithm

//find fibonacci numbers

function fib(n){
  if(n >=3 ){
    return fib(n-1) + fib(n-2)
  } else {
    return 1;
  }
}

console.log(fib(10))
content_copyCOPY