fix (curriculum): changed the index to 0 for the fibonacci sequence challenge (#38331)

This commit is contained in:
Hassaan Pasha
2020-03-10 15:43:41 +05:00
committed by GitHub
parent a2d31afe81
commit 8c435c8b75

View File

@ -28,12 +28,12 @@ tests:
testString: assert(typeof fibonacci === 'function'); testString: assert(typeof fibonacci === 'function');
- text: <code>fibonacci(2)</code> should return a number. - text: <code>fibonacci(2)</code> should return a number.
testString: assert(typeof fibonacci(2) == 'number'); testString: assert(typeof fibonacci(2) == 'number');
- text: <code>fibonacci(3)</code> should return 1. - text: <code>fibonacci(3)</code> should return 2.
testString: assert.equal(fibonacci(3),1); testString: assert.equal(fibonacci(3),2);
- text: <code>fibonacci(5)</code> should return 3. - text: <code>fibonacci(5)</code> should return 5.
testString: assert.equal(fibonacci(5),3); testString: assert.equal(fibonacci(5),5);
- text: <code>fibonacci(10)</code> should return 34. - text: <code>fibonacci(10)</code> should return 55.
testString: assert.equal(fibonacci(10),34); testString: assert.equal(fibonacci(10),55);
``` ```
@ -63,7 +63,7 @@ function fibonacci(n) {
```js ```js
function fibonacci(n) { function fibonacci(n) {
let a = 0, b = 1, t; let a = 0, b = 1, t;
while (--n > 0) { while (--n >= 0) {
t = a; t = a;
a = b; a = b;
b += t; b += t;