variable having integer value in function but return undefined (in javascript) [duplicate]

let f1 = 0
let f2 = 1
let i=3

function fibonachi(position, f1,f2,i){
  if(position<=1){
    if(position==1){
      return 0
    }
    else if(position ==2) return 1
  }
  let f3 = f1+f2
  f1=f2
  f2=f3
  if(i>=position){
    console.log(f3)
    return f3
  }
  fibonachi(position,f1,f2,i+1)
}

let res = fibonachi(7,f1,f2,i)
console.log(res)

line 16 logs out “8” but line 17 returns undefined. How can i make it return its value is ther any way , i dont wanna change the procedure of solving.