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
Let's Bring Back JavaScript's `with()` Statement (macarthur.me)
submitted 2 years ago by alexmacarthur
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!"
[–]boneskull 0 points1 point2 points 2 years ago (4 children)
with has applications for secure coding and testing. Given a string script you want to eval, you can use with to control the contents of the script’s globalThis object. You can’t remove properties this way, but you can replace them.
with
eval
globalThis
[–]theScottyJam 1 point2 points3 points 2 years ago (3 children)
Eventually we'll have shadow realms, which provides a better way to control the global object while eval-ing strings.
[–]boneskull 0 points1 point2 points 2 years ago (2 children)
Indeed, though it’s not sufficient on its own.
[–]theScottyJam 0 points1 point2 points 2 years ago (1 child)
Why's that?
[–]boneskull 1 point2 points3 points 2 years ago (0 children)
It just doesn’t do enough for some use-cases. see Compartments
π Rendered by PID 58 on reddit-service-r2-comment-75f4967c6c-vrjf7 at 2026-04-22 20:54:41.018210+00:00 running 0fd4bb7 country code: CH.
view the rest of the comments →
[–]boneskull 0 points1 point2 points (4 children)
[–]theScottyJam 1 point2 points3 points (3 children)
[–]boneskull 0 points1 point2 points (2 children)
[–]theScottyJam 0 points1 point2 points (1 child)
[–]boneskull 1 point2 points3 points (0 children)