Last active
April 20, 2016 09:23
-
-
Save rozanovz/d4d639c8f6f4e222c5f06d45259ce9a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fib = function(numMax){ | |
| var counter = 0, | |
| i = 1, | |
| j = 1; | |
| for (var k = 0; k < numMax; k++) { | |
| if ((Math.max(i,j) % 2) !==0) | |
| counter++; | |
| x = i + j; | |
| i = j; | |
| j = x; | |
| } | |
| return counter; | |
| }; | |
| console.log(fib(20)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment