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