Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function __fib2(n) {
- const fibs = [];
- Array.from({length: n + 1}).map((x, i) => i).forEach(i => {
- let result;
- if (i <= 1) {
- result = i;
- } else {
- result = fibs[i - 2] + fibs[i - 1];
- }
- fibs.push(result);
- });
- return fibs;
- }
Add Comment
Please, Sign In to add comment