challenge-algorithms-v2.0-c.../04-fibonacci/index.js

6 lines
147 B
JavaScript

export function fibonacci(value) {
if (value === 0 || value === 1){
return value;
}
return fibonacci(value -1) + fibonacci(value -2);
}