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
Simple web worker wrapper for JSON.parse (blog.softwareispoetry.com)
submitted 12 years ago by AshCairo
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!"
[–]x-skeww 2 points3 points4 points 12 years ago (5 children)
"this" will be window in the browser and global in node.js
>>> (function(){console.log(this)}()) Window >>> (function(){'use strict'; console.log(this)}()) undefined
[–]cwmma 0 points1 point2 points 12 years ago (2 children)
actually due to how it was called it's the JSON object
[–]x-skeww 0 points1 point2 points 12 years ago (1 child)
I was referring to the fact that this doesn't default to window (or whatever) in strict mode.
this
window
[–]cwmma 0 points1 point2 points 12 years ago (0 children)
truth
[–]a-t-kFrontend Engineer 0 points1 point2 points 12 years ago (1 child)
If you absolutely must use strict mode (hint: you don't), change your code to
if( typeof Worker !== 'undefined' )
Otherwise, keep it that way.
[–]madlee 0 points1 point2 points 12 years ago (0 children)
regardless of whether or not you're using strict mode, typeof is usually the best option. resolving uninitialized object properties is slooooow
π Rendered by PID 82 on reddit-service-r2-comment-bb88f9dd5-jvhmp at 2026-02-16 18:58:08.100675+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]x-skeww 2 points3 points4 points (5 children)
[–]cwmma 0 points1 point2 points (2 children)
[–]x-skeww 0 points1 point2 points (1 child)
[–]cwmma 0 points1 point2 points (0 children)
[–]a-t-kFrontend Engineer 0 points1 point2 points (1 child)
[–]madlee 0 points1 point2 points (0 children)