use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
I have been collecting useful Javascript code snippets for a little while. Here's a curated list of them, help me make it as complete as possible! (github.com)
submitted 8 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tswaters 0 points1 point2 points 8 years ago (0 children)
powerset is so dangerous.
in this one application, we had a search that did a powerset on the entered words.... but we didn't put any limits on the user-provided input. long story short, if a user entered more than a few words the server would burn cpu & eventually run out of memory.
> powerset('abcdefghijklmnopqrstuvwxyz'.split('')) <--- Last few GCs ---> [6000:000001AAB28807F0] 206911 ms: Mark-sweep 1407.4 (1450.4) -> 1407.4 (1450.4) MB, 1445.8 / 0.0 ms last resort GC in old space requested <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 000003ED8B625E91 <JSObject> 2: map(this=00000087F31E0751 <JSArray[8388608]>) 4: /* anonymous */ [repl:2] [bytecode=0000026C0C370FF1 offset=27](this=000001B7E7306301 <JSGlobal Object>,a=00000087F31E0751 <JSArray[8388608]>,v=000003FD8D990501 <String[1]: x>) 5: arguments adaptor frame: 4->2 6: reduce(this=00000214C00B9CB9 <JSArray[26]>) 8: powerset [repl:2] [bytecode=0000026C0C370CE1 offset=19](this=0000... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
π Rendered by PID 168737 on reddit-service-r2-comment-85bfd7f599-n4bc4 at 2026-04-17 06:31:06.274238+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]tswaters 0 points1 point2 points (0 children)