(n)
| 19 | 'use strict'; |
| 20 | |
| 21 | function fibonacci(n) { |
| 22 | if (n > 97) { |
| 23 | throw 'Input too large, results in inaccurate fibonacci value.'; |
| 24 | } |
| 25 | var n1 = 0; |
| 26 | var n2 = 1; |
| 27 | var aux; |
| 28 | |
| 29 | while (n > 0) { |
| 30 | aux = n1; |
| 31 | n1 = n2; |
| 32 | n2 += aux; |
| 33 | n = n - 1; |
| 34 | } |
| 35 | |
| 36 | return n1; |
| 37 | } |
| 38 | |
| 39 | exports.fibonacci = fibonacci; |
| 40 | })(typeof window === 'undefined' ? module.exports : window); |
no outgoing calls
no test coverage detected