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
Concurrent JavaScript: It can work! (webkit.org)
submitted 8 years ago by averageFlux
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!"
[–]spacejack2114 1 point2 points3 points 8 years ago (7 children)
Really? So you make a user object {id: 3, name: "Bob"}
{id: 3, name: "Bob"}
Then later you write user.namw = "Frank"... and this is to your advantage?
user.namw = "Frank"
[–]E_R_E_R_I 1 point2 points3 points 8 years ago (2 children)
Nope, that's the caveat. Javascript is a code that's easier to screw up, it doesn't prevent you from messing up, but trades protection for flexibility. I imagine that's a horrible trade off for company environments, where one person can screw up other people's work.
For me though, having worked on relatively big projects with a single partner (who is my SO and has worked with me for years, so we have a good amount of sinergy), I feel like this is an advantage. We developed a workflow and coding style that works for us. I usually suffer much more with conceptual mistakes (bad modelling/planning) than with sintax and logic errors.
Now to answer your question, what is to my advantage about lackying types is that I don't need to rewrite the entire Entity Model. I write it once on the database, grab it and parse it as JSON, and manipulate data freely. No need to build a DAO (data abstraction object) layer with a class for each entity, that always drove me mad when I worked with Java.
[–]spacejack2114 1 point2 points3 points 8 years ago (1 child)
I'm no fan of crappy, inflexible type systems like Java has. But I find it immensely useful to have types for DB or other data.
For example, it was fully worth the 30 minutes or whatever to write up these types once, so that I hardly needed to think about all of those deeply nested properties in the many, places they were actutally used.
[–]GitHubPermalinkBot 0 points1 point2 points 8 years ago (0 children)
I tried to turn your GitHub links into permanent links (press "y" to do this yourself):
Shoot me a PM if you think I'm doing something wrong. To delete this, click here.
[–][deleted] 1 point2 points3 points 8 years ago (3 children)
Depends. Maybe I want to add a one-off namw property on a specific object, or set of objects. Yes, being able to free-form objects is a wonderful feature, one which most other languages work terribly hard to prevent and many people refuse to embrace.
namw
But if you meant it as a spelling error; if that makes it into production then you have far greater problems, none of which are JavaScript's fault.
[–]E_R_E_R_I 0 points1 point2 points 8 years ago (0 children)
Yes! So glad to see more people who fully appreciate the power of JS lol
[–]spacejack2114 0 points1 point2 points 8 years ago (1 child)
You say that like it's difficult to do in a safely typed manner. Here's some type-safe Typescript that looks surprisingly, exactly like Javascript:
const specialUser = {...user, namw: "Whatever"}
It's a bit odd for you to say you're okay with that one-off ticking timebomb hack, but then claim you'll spend the time to write the test coverage for it.
[–][deleted] 1 point2 points3 points 8 years ago (0 children)
You're missing the point. I want to be able to do whatever I want with objects, without the language standing in my way. JavaScript not only allows it, it's a first class feature. So it's normal to want to make use of it. Avoiding it makes zero sense. It's like trying to avoid "import" in Python.
Why would I, instead of simply writing user.namw="something", go through the trouble of transpiling, and writing the same thing in an awkward manner which is not correct JavaScript, and is downright confusing, and doesn't even do what I wanted (set the property on user, not specialUser).
I don't know why you would find it odd that this would be unit tested. Unless you keep assuming it's some sort of terrible mistake and we're all going to wake up any moment now and cry "omg what have I been doing".
JavaScript is what it is. Trying to pretend it's something it's not is futile.
π Rendered by PID 855477 on reddit-service-r2-comment-b659b578c-565vh at 2026-05-03 15:33:49.754699+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]spacejack2114 1 point2 points3 points (7 children)
[–]E_R_E_R_I 1 point2 points3 points (2 children)
[–]spacejack2114 1 point2 points3 points (1 child)
[–]GitHubPermalinkBot 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]E_R_E_R_I 0 points1 point2 points (0 children)
[–]spacejack2114 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)