Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
LazyListJS
//JavaScript-C24.2.0 (SpiderMonkey) function Stream (value, increment) { this.value = value; this.increment = increment; Object.defineProperty(this, 'next', { get : function() { return new Stream(value + increment, increment); } }); } Stream.prototype.takeUntil = function (n, accumulator) { accumulator = accumulator || []; if (n < this.value) { return; } if (n === this.value) { return accumulator; } accumulator.push(this.value); return this.next.takeUntil(n, accumulator) }; var stream = new Stream(10, 0.5); print(stream.takeUntil(20))
run
|
edit
|
history
|
help
0
Javascript Basics
Loops
Tyu
js
fratrade
Javascript Basics
js object to json string
MyProfile_Medalla.java
greeting
ComposeWordsGrid