nth
Fibonacci number.
The nth
Fibonacci number is given by:
Fn = Fn-1 + Fn-2
The first two terms of the series are 0 and 1.
Hence, the series is: 0, 1, 1, 2, 3, 5, 8, 13...
fibonacci
should be a function.
testString: assert(typeof fibonacci === 'function');
- text: fibonacci(2)
should return a number.
testString: assert(typeof fibonacci(2) == 'number');
- text: fibonacci(3)
should return 1.
testString: assert.equal(fibonacci(3),1);
- text: fibonacci(5)
should return 3.
testString: assert.equal(fibonacci(5),3);
- text: fibonacci(10)
should return 34.
testString: assert.equal(fibonacci(10),34);
```