Guest User

Untitled

a guest
Dec 17th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. function __fib3(n) {
  2. return Array.from({length: n + 1}).reduce((r, _, i) => {
  3. let result;
  4. if (i <= 1) {
  5. result = i;
  6. } else {
  7. result = r[i - 2] + r[i - 1];
  8. }
  9.  
  10. r.push(result);
  11. return r;
  12. }, []);
  13. }
Add Comment
Please, Sign In to add comment