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

10 lines
240 B
JavaScript

export function fibonacci(value) {
// implementar logica aqui
if (value < 1) {
return 0
} else if (value <= 2) {
return 1
} else {
return (fibonacci(value - 1) + fibonacci(value - 2))
}
}