Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
JavaScript - CheckDate()
Probability
rr
prime consecutive numbers
Javascript
Herrn
random3
Daddy
My Code1
House prices
Please log in to post a comment.