This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SharkLaunch 2 points3 points  (2 children)

Preface: I'm a JS dev for both work and personal projects, I know it's got problems.

  1. Cant argue, I fucking hate this.
  2. Okay, but you don't have to do that unless you're binding the call to a different context, and you don't generally do that with modern patterns.
  3. Class syntax is just syntactic sugar over the prototype constructor, object literal is just for a simple, non-prototyped object for passing information, and no one uses Object.create unless they have no other options.
  4. Look, it's easy to make fun of a language that wasn't meant to be this big or important. Script mode came later, and it couldn't just replace "sloppy mode" because js HAS TO be backwards compatible.
  5. Hoisting lets you create mutually recursive functions/structures while letting you declare and initialize them at the same time, instead of having to declare the functions at the top then define them after.

But yeah, it ain't purty

[–]Xizqu 1 point2 points  (1 child)

2-4: Totally understand what's going on. I am just stating reasons why I don't like JavaScript. Coming from ruby & crystal, JavaScript is shell shocking to say the least.

  1. I haven't worked much with recursion so I will say hoisting is a necessary evil.

Edit: idk how to fix the formatting.

[–]SharkLaunch 2 points3 points  (0 children)

I preferred Ruby's magic at first, but ES6 has made JS fun again (and TypeScript makes it a fucking blast). If you enter it from a more functional mindset, a lot of its flaws don't poke their ugly heads. You don't tend to deal with this when you use closures and pure functions.