Javascrpt aglorithm help

I cant figure out why this is returning null

n is already equalled to 29

I had to make the output 11

i put it minus 18 so i can get it to equal 11

not to mention the other times i have to to this

console.log statement returns undefined, you are returning that instead of a value

n is already = to 29

the output is the value returned from the function

return console.log(...) means the function returns undefined
you can’t put console.log in a return statement