Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
LazyListJS
//JavaScript-C24.2.0 (SpiderMonkey) function Stream (value) { this.value = value; Object.defineProperty(this, 'next', { get : function() { return new Stream(value + 1); } }); } 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); print(stream.takeUntil(20))
run
|
edit
|
history
|
help
0
First Non Repeating Character
9
Loops
Javascript Basics
J
rr
game
Remove Duplicates
my dick!!!
Javascript reverse string, one index