Order exercise folders

Ordered the exercise folders by placing their numbers in their folder name
This commit is contained in:
Benjo Kho
2021-08-07 14:21:26 +08:00
parent ebdc86a349
commit 55cfb173d8
40 changed files with 0 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
# Exercise 10 - Fibonacci
Create a function that returns a specific member of the Fibonacci sequence:
> A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.
```javascript
fibonacci(4) // returns the 4th member of the series: 3 (1, 1, 2, 3)
fibonacci(6) // returns 8
```
+5
View File
@@ -0,0 +1,5 @@
const fibonacci = function() {
};
module.exports = fibonacci;
+31
View File
@@ -0,0 +1,31 @@
const fibonacci = require('./fibonacci')
describe('fibonacci', () => {
test('4th fibonacci number is 3', () => {
expect(fibonacci(4)).toBe(3);
});
test.skip('6th fibonacci number is 8', () => {
expect(fibonacci(6)).toBe(8);
});
test.skip('10th fibonacci number is 55', () => {
expect(fibonacci(10)).toBe(55);
});
test.skip('15th fibonacci number is 610', () => {
expect(fibonacci(15)).toBe(610);
});
test.skip('25th fibonacci number is 75025', () => {
expect(fibonacci(25)).toBe(75025);
});
test.skip('doesn\'t accept negatives', () => {
expect(fibonacci(-25)).toBe("OOPS");
});
test.skip('DOES accept strings', () => {
expect(fibonacci("1")).toBe(1);
});
test.skip('DOES accept strings', () => {
expect(fibonacci("2")).toBe(1);
});
test.skip('DOES accept strings', () => {
expect(fibonacci("8")).toBe(21);
});
});