Passed first 5 tests of exercise 10
This commit is contained in:
parent
9d02464e9d
commit
ad1ef473d6
|
@ -1,5 +1,11 @@
|
|||
const fibonacci = function() {
|
||||
|
||||
const fibonacci = function(number, b) {
|
||||
let sum;
|
||||
for (let i = 0, a = 1, b = 1;
|
||||
i < number - 2;
|
||||
i++, (i % 2 == 0) ? a = sum : b = sum) {
|
||||
sum = a + b;
|
||||
}
|
||||
return sum;
|
||||
};
|
||||
|
||||
// Do not edit below this line
|
||||
|
|
|
@ -4,16 +4,16 @@ describe('fibonacci', () => {
|
|||
test('4th fibonacci number is 3', () => {
|
||||
expect(fibonacci(4)).toBe(3);
|
||||
});
|
||||
test.skip('6th fibonacci number is 8', () => {
|
||||
test('6th fibonacci number is 8', () => {
|
||||
expect(fibonacci(6)).toBe(8);
|
||||
});
|
||||
test.skip('10th fibonacci number is 55', () => {
|
||||
test('10th fibonacci number is 55', () => {
|
||||
expect(fibonacci(10)).toBe(55);
|
||||
});
|
||||
test.skip('15th fibonacci number is 610', () => {
|
||||
test('15th fibonacci number is 610', () => {
|
||||
expect(fibonacci(15)).toBe(610);
|
||||
});
|
||||
test.skip('25th fibonacci number is 75025', () => {
|
||||
test('25th fibonacci number is 75025', () => {
|
||||
expect(fibonacci(25)).toBe(75025);
|
||||
});
|
||||
test.skip('0th fibonacci number is 0', () => {
|
||||
|
|
Loading…
Reference in New Issue