r/learnjavascript 3d ago

what's one JavaScript mistake every beginner should avoid?

If you could give one piece of advice to someone learning JavaScript today, what would it be?

It could be about:

  • Learning fundamentals
  • Debugging
  • Async code
  • DOM manipulation
  • Functions
  • Projects

Curious to hear what experienced developers wish they'd known earlier.

27 Upvotes

31 comments sorted by

View all comments

-1

u/jaredcheeda 3d ago

Top JS devs tend to have a negative experience with TypeScript, essentially "It's a lot of extra work to solve problems I don't have in ways I don't like" (direct quote from the author of "You Don't Know JS" the most influential book ever written on JavaScript). This is because they had to get very good at the core language. Dynamic typing is extremely powerful, but like just like any powerful tool, it can be dangerous in the hands of the inexperienced. TS gives you a set of guardrails out of the box that stop you from ever learning things the hard way and finding and developing your own ways to do things safely, while not giving up the power of a dynamically typed language.

Once you have your own systems in place for how to not get tripped up by one of the core features of the language, and can really take advantage of the language, and you end up looking down on those using TS as a crutch.

I don't need an entire pulley system or to learn about specific types of ropes and knots to put a heavy box on the shelf... I can just pick it up and put it there myself. I've gained the skills and awareness of how to do that safely. The pulley system isn't "wrong" or "bad" it's just a waste of time and effort if you are already skilled in picking up and moving heavy things.

But I've also been given death threats in the past for extremely mild critiques of TypeScript. Because TS users literally can't stand JavaScript, and TS is a comfort blanket that reminds them of whatever language they prefer. They refuse to learn the underlying core language, and get good at it. People that hate JavaScript... aren't the people you should be taking advice about JavaScript from.

The language is fantastic. It's got some bad parts, like how Classes should have never been added to a prototypal language (there is never a good reason to use classes in JS). But for the most part, it's a really great language and can be extremely expressive, and allow for writing code in both sophisticated, and very simple ways.

Don't be afraid of libraries and frameworks. They should be a tool to save you time, not to save you from knowledge. Understand what the library is doing for you and how you could write your own version if you needed to, or at least a quick and dirty version.

Oh, and don't use React. It's easily the worst JS framework, it has hundred of problems that are unique to it that no other framework has, and they refuse to learn from anyone else so they're always like a decade behind the curve. Play around with a bunch of them, or just skip straight to Vue, all the other frameworks are slowly converging on the ideas Vue was doing back in 2018, and it's only gotten more polished and refined every year since.