Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. let find = (a, b, n) => {
  2. let temp1 = '' + a + b;
  3. let temp2 = a;
  4. let temp3 = b;
  5.  
  6. if (a === 0 && b === 0) {
  7. return 0;
  8. }
  9.  
  10. for (let i = 0; i <= n; i++) {
  11. if (temp1[n]) {
  12. return parseInt(temp1[n]);
  13. }
  14. temp1 += parseInt(temp2) + parseInt(temp3);
  15. temp2 = temp1[temp1.length - 1];
  16. temp3 = temp1[temp1.length - 2];
  17. }
  18.  
  19. return null;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement