Skip to main content Accessibility Feedback

Why you should learn vanilla JS first

tl;dr: use whatever helps you learn faster, but that’s probably not actually frameworks.

Earlier this week, Mark Dalgleish tweeted:

It’s a mistake to learn a framework without first learning the fundamentals. That’s why, when dealing with beginners, I always start off by making them build their own CPU, programming language and operating system.

He’s being cheeky, of course, but I’ve heard some form of this argument a bunch of times before.

“It’s important to understand how your tools work,” turns into, “So beginners should learn C++ first so they know how their browser works? They should learn Linux so they understand how their OS works?”

Obviously, that’s absurd. The argument is reductive, hand-wavy, and overly-simplistic.

Learning momentum

The point many “learn frameworks first” advocates are actually trying to make is that getting started is more important than understanding everything about how it works.

I agree!

I learned JavaScript by working with jQuery first. Then, eventually, I dipped into vanilla JS and started converting some of my old scripts.

jQuery helped me go from zero to working code a lot faster. I think that’s really important, especially for beginners. Without that momentum, you get demotivated and give up.

However… vanilla JS has come a long way from when I learned. It’s borrowed a lot of conventions from jQuery, and smoothed out tons of cross-browser issues that were terrible to deal with years ago.

You can go from “I know nothing” to “I built a working script” in about 15 minutes with vanilla JS. I know because I’ve taught people to do just that before.

Frameworks are different

Frameworks (arguably) make building complex applications easier, but they make doing simple stuff more complex.

And that’s why I think people should learn vanilla JS first. I’ve had many students who tried to learn frameworks get frustated, quit, and focus on vanilla JS.

Some of them have gone back to frameworks later, and told me that knowing vanilla JS made it a lot easier for them to pick up frameworks afterwards.

If you find frameworks easier, start there and back into vanilla JS. If you find them weird and confusing, start with vanilla JS and, if you want to later, expand into frameworks.