Guest User

Untitled

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