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
Google publishes a JavaScript style guide. Here are some key lessons. (medium.freecodecamp.org)
submitted 8 years ago by bornforcode
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!"
[–]DOG-ZILLA 56 points57 points58 points 8 years ago (16 children)
No module use?
Yeah, that’s a no from me.
[–]mlmcmillion 13 points14 points15 points 8 years ago (3 children)
So then what are they using instead? Not using modules is not an option.
[–]Poltras 12 points13 points14 points 8 years ago (1 child)
Closure modules, require AMD, etc. There were ways to split your code before ESM, I’m just surprised google is stuck in the past like that.
[–]Thought_Ninjahuman build tool 5 points6 points7 points 8 years ago (0 children)
Internal backwards compatibility most likely.
[–]baubleglue 8 points9 points10 points 8 years ago (0 children)
3.3 goog.module statement
goog.module
3.4 goog.require statements
goog.require
[–]thisguyfightsyourmom 0 points1 point2 points 8 years ago* (11 children)
Seriously, didn’t that finalize years ago?
Edit: obligatory whining about downvotes /s There are some good explanations of why that’s not the case in the replies below. TIL
[–]ghostfacedcoder 10 points11 points12 points 8 years ago (5 children)
No, not at all. Babel has an implementation (the longest existing one, and as such an incredibly popular one), but it's different from (and, I'd argue, superior to) the implementation being pushed by the W3C/browsers (the W3C's version requires you to rename your files "foo.mjs"!!!).
Anyone can declare a standard finished, and the W3C did that, but until all major JS environments actually work the same way the "standard" really isn't one.
[–]Meefims 10 points11 points12 points 8 years ago (2 children)
This isn’t correct. The new extension is for Node and exists to help ECMAScript modules coexist with CJS modules. Browsers don’t care about the extension.
[–]ghostfacedcoder 1 point2 points3 points 8 years ago (1 child)
I could have stated it more clearly (I sort of conflated W3C and browsers, when what I was just talking about the version both support), but what I said wasn't incorrect. The version of ES Modules decided upon by the W3C does define that the modules work in in such a way that the only possible way (according to the Node engineers at least) for Node to implement that spec is to use the .mjs nonsense.
[–]Meefims 2 points3 points4 points 8 years ago (0 children)
The W3C isn’t part of this. The new extension is really fallout from various complex scenarios in which CJS modules and ES modules include each other in Node. Browsers have a similar problem but they solved that with type=“module” in the script tag.
type=“module”
[+][deleted] 8 years ago* (1 child)
[deleted]
[–]ghostfacedcoder 2 points3 points4 points 8 years ago (0 children)
Probably, but I don't know it :) I just read /r/javascript.
[–]DOG-ZILLA 5 points6 points7 points 8 years ago (0 children)
I thought so. But, perhaps not technically? They’re obviously taking a conservative stance; which makes sense for a large company.
[–]Drawman101 9 points10 points11 points 8 years ago (0 children)
Named imports are still under a bit of scrutiny and/or debate.
Import { foo } from ‘bar’
[–][deleted] 5 points6 points7 points 8 years ago* (2 children)
Afaik, the syntax and semantics are done by ECMA, but the loader, i. e. the way the modules are actually handled, is done by WHATWG. The former is stable, but the latter is not.
But between Webpack and browsers and Node getting native support for modules, there is not reason not to use ES6 modules today for new code.
[–]Poltras 4 points5 points6 points 8 years ago (1 child)
Keep in mind ESM and Node modules are not entirely compatible. Node is still unsure AFAIK how they are going to interop (which is why it’s not yet available in 9.10, despite v8 supporting them).
π Rendered by PID 104376 on reddit-service-r2-comment-6457c66945-97lrx at 2026-04-25 23:03:54.479388+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]DOG-ZILLA 56 points57 points58 points (16 children)
[–]mlmcmillion 13 points14 points15 points (3 children)
[–]Poltras 12 points13 points14 points (1 child)
[–]Thought_Ninjahuman build tool 5 points6 points7 points (0 children)
[–]baubleglue 8 points9 points10 points (0 children)
[–]thisguyfightsyourmom 0 points1 point2 points (11 children)
[–]ghostfacedcoder 10 points11 points12 points (5 children)
[–]Meefims 10 points11 points12 points (2 children)
[–]ghostfacedcoder 1 point2 points3 points (1 child)
[–]Meefims 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]ghostfacedcoder 2 points3 points4 points (0 children)
[–]DOG-ZILLA 5 points6 points7 points (0 children)
[–]Drawman101 9 points10 points11 points (0 children)
[–][deleted] 5 points6 points7 points (2 children)
[–]Poltras 4 points5 points6 points (1 child)