how to get nth fibonacci javascript

Solutions on MaxInterview for how to get nth fibonacci javascript by the best coders in the world

showing results for - "how to get nth fibonacci javascript"
Clea
13 Jan 2017
1function nthFib(n) {
2	if(n <= 2) return n -1;
3  return nthFib(n - 2) + nthFib(n - 1);
4}