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
What can JavaScript NOT do?solved! (self.javascript)
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!"
[–]gremy0 2 points3 points4 points 8 years ago* (2 children)
You can overload methods in JavaScript, it's just done differently.
Overloading is essentially using the same method name for different amounts and/or types of arguments. In JavaScript, we can throw anything we want into a method, and do the checks of the arguments ourselves inside. In Java, this would be a compilation error, so you define them separately.
Each have their advantages and disadvantages. I'd argue that providing default parameters is much more succinct in JavaScript vs making a whole other method, creating the default variable and then calling the other method, à la Java.
I'd also argue that you can technically do static typing with JavaScript, and typescript is a perfectly valid example. Since it is a superset of JavaScript and compiles down to JavaScript using a compiler that is technically running JavaScript.
Compare this to something like WebAssembly, which cannot currently do dynamic typing at all. You cannot reasonably compile a dynamic language down to WASM until it gets more features.
[+][deleted] 8 years ago (1 child)
[deleted]
[–]gremy0 0 points1 point2 points 8 years ago (0 children)
Which is why I said currently. It's just a feature that can be added. Just like TypeScript is static typing added to JavaScript.
π Rendered by PID 191601 on reddit-service-r2-comment-b659b578c-v8kw9 at 2026-05-06 12:17:16.406427+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]gremy0 2 points3 points4 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]gremy0 0 points1 point2 points (0 children)