Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let find = (a, b, n) => {
- let temp1 = '' + a + b;
- let temp2 = a;
- let temp3 = b;
- if (a === 0 && b === 0) {
- return 0;
- }
- for (let i = 0; i <= n; i++) {
- if (temp1[n]) {
- return parseInt(temp1[n]);
- }
- temp1 += parseInt(temp2) + parseInt(temp3);
- temp2 = temp1[temp1.length - 1];
- temp3 = temp1[temp1.length - 2];
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement