Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Documentation of `for...from` for iterating over generator functions * Add note that the CoffeeScript compiler does not, in fact, generate JavaScript that runs in every JavaScript runtime 😢
- Loading branch information
1 parent
6c759d4
commit 56482a3
Showing
3 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fibonacci = -> | ||
[previous, current] = [1, 1] | ||
loop | ||
[previous, current] = [current, previous + current] | ||
yield current | ||
return | ||
|
||
getFibonacciNumbers = (length) -> | ||
results = [1] | ||
for n from fibonacci() | ||
results.push n | ||
break if results.length is length | ||
results |
This file contains 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