EXERCISE · AlgoCasts

Fibonacci

Print out the n-th entry in the fibonacci series. The fibonacci series is an ordering of numbers where each number is the sum of the preceeding two.

6 testsAlgoCastsGPL-3.01 alternateexercise 13 of 26

Directions

Directions

Print out the n-th entry in the fibonacci series. The fibonacci series is an ordering of numbers where each number is the sum of the preceeding two. For example, the sequence [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] forms the first ten entries of the fibonacci series. Example: fib(4) === 3

Try it first#

Copy the stub, make the 6 tests pass on your machine, then open the solution. The reveal is remembered per page in this browser.

JSexercises/fib/index.js
function fib(n) {} module.exports = fib;

See also