UNPKG
theorem.js
Version:
latest (1.2.0)
1.2.0
1.1.0
1.0.1
1.0.0
0.1.0
0.0.2
0.0.1
A Math library for computation in JavaScript
github.com/arguiot/TheoremJS
arguiot/TheoremJS
theorem.js
/
src
/
includes
/
functions
/
math
/
generators
/
fibonacci.js
15 lines
(14 loc)
•
264 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
*
fibonacci
(
) {
let
fn1 =
0
;
let
fn2 =
1
;
while
(
true
) {
const
current = fn1; fn1 = fn2; fn2 = fn1 + current;
const
reset =
yield
current;
if
(reset) { fn1 =
0
; fn2 =
1
; } } }