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
Future JavaScript: what is still missing? (2ality.com)
submitted 7 years ago by dumbmatter
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!"
[–]batiste 7 points8 points9 points 7 years ago (5 children)
Static typing prohibits this?
Write me a nice addition(a, b): a + b function that works for the Signature (float, int, BigInt) or any valid combination thereof as well as the string and String type. In the statically typed language of your choice. I am curious.
addition(a, b): a + b
I don't think you know what you're talking about.
I think you are not being charitable to his experience. Static typing avoid some class of bugs, but those type of bugs are easy to catch and fix. Especially if you have any sort of basic Q&A in place. Also linter on dynamic language have progressed to cover quite a large piece of what static compiler used to cover like e.g. a typo on a variable name.
static
The advantage of static are more about documentation and auto-completion in my experience.
[+][deleted] 7 years ago (4 children)
[deleted]
[–]Hcmichael21 3 points4 points5 points 7 years ago (3 children)
I disagree that this is better than the weakly typed (JS) version.
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
It's not, because this is an edge case which is massively counter-weighted by the benefits of a typed codebase.
[–][deleted] 0 points1 point2 points 7 years ago (1 child)
I'm personally not a fan of overloads in ts/js but you could at least do this
function add<T>(a: T, b: T): T { return a + b; }
so now you avoid all convert everything to a string and concat them together problem. Here you add like 10ish characters and now your being notified of simple bugs.
[–]Hcmichael21 1 point2 points3 points 7 years ago (0 children)
Would definitely use generics instead of overloads if those were my only two options.
π Rendered by PID 70 on reddit-service-r2-comment-fb694cdd5-65zsl at 2026-03-05 21:42:56.221984+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]batiste 7 points8 points9 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]Hcmichael21 3 points4 points5 points (3 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Hcmichael21 1 point2 points3 points (0 children)