Why should you learn JavaScript as the first approach – according to Quincy Larson – freeCodeCamp founder9 min read

There are lots of reasons why I recommend learning JavaScript as your first programming language, instead of Python or Java.

Before I talk about these programming languages, let me clarify:

  • I’m not arguing that any one language is objectively better than any other
  • I agree that developers should eventually learn more than one language
  • I’m arguing that first they should learn one language well. And  that language should be JavaScript.

Reason #1: Lots of developers know JavaScript. Very few of them know it well. Employers want to hire developers who know JavaScript well.

If you’re learning to program purely out of intellectual curiosity, feel free to skip to the next reason. But if you — like the vast majority of people learning to program — want to use this skill to get a job, this is an important consideration.

Java is mentioned in more job postings than any other programming language. JavaScript is a close second.

But here’s the thing about JavaScript: even though it’s been around for 20 years, it only recently became a serious tool that companies like Netflix, Walmart, and PayPal would build entire applications around.

As a result, plenty of companies are hiring JavaScript developers, but there just aren’t that many on the job market.

Data from Indeed.com

There are 2.7 Java developers competing for every open Java position. Competition for PHP and iOS jobs is similarly fierce.

But for every open JavaScript position, there are only 0.6 JavaScript developers. It is very much a sellers’ market for developers with JavaScript skills.

Reason #2: JavaScript has great long term prospects

The average JavaScript project receives twice as many pull requests as the average Java, Python, or Ruby project. And on top of this, JavaScript is growing faster than any other popular language.

Source: The GitHub’s 2016 State of the Octoverse

JavaScript’s ecosystem also benefits from a heavy investment of money and engineering talent from companies like Google, Microsoft, Facebook, and Netflix.

For example, TypeScript (a statically-typed superset of JavaScript) has more than 100 open source contributors, many of whom are Microsoft and Google employees being paid to work on it.

This type of inter-company cooperation is harder to find with Java. Oracle — who effectively owns Java through its acquisition of Sun Microsystems — often suescompanies who try to expand upon it.

Reason #3: JavaScript is much easier to learn than most other languages.

This is a parody of an XKCD comic.

Most programmers would agree that high-level scripting languages are relatively easy to learn. JavaScript falls into this category, along with Python and Ruby.

Even though universities still teach languages like Java and C++ as first languages, they’re considerably harder to learn.

Reason #4: You can build tons of projects using just JavaScript, and easily share them with your friends for feedback.

This is where JavaScript really shines. JavaScript runs on any device that has a browser, right there in the browser. You can build basically anything with JavaScript, and share it anywhere.

Because of JavaScript’s ubiquity, Stack Overflow co-founder Jeff Atwood coined his now-famous law:

“Any application that can be written in JavaScript, will eventually be written in JavaScript.”

And with each passing month, Atwood’s Law holds strong.

Java once promised to run everywhere, too. You may remember Java Applets. Oracle officially killed them off earlier this year.

Python suffers from much the same problems:

“How can I give this game I made to my friend? Even better, is there a way can I put this on my phone so I can show it to kids at school without them having to install it? Um.” — James Hague in Retiring Python as a Teaching Language

By contrast, here are some apps that members of our open source community built in their browsers on CodePen. You can click through and use these right in your browser:

1970s style Simon game

Conway’s Game of Life

Star Wars-themed Wikipedia Search

A roguelike dungeon crawler game

Learn one language well. Then learn a second one.

If you keep jumping from language to language, you won’t get far.

In order to move beyond the basics, you need to learn your first language well. Then your second language will be much, much easier.

From there, you can branch out, and become a more well-rounded developer by learning lots of languages:

  • C is a great way to learn how computers actually work in terms of memory management, and is useful in high-performance computing
  • C++ is great for game development.
  • Python is awesome for science and statistics.
  • Java is important if you want to work at large tech companies.

But learn JavaScript first.

OK, now I’m going to attempt the impossible — I’m going to try and anticipate objections from the comments section.

Objection #1: But isn’t JavaScript slow?

JavaScript is — for most practical purposes — as fast as high-performance languages.

JavaScript (Node.js) is orders of magnitude faster than Python, Ruby, and PHP.

It is also nearly as fast as high-performance languages like C++, Java, and Go.

Here are the results of the most comprehensive recent cross-language benchmark:

Objection #2: But JavaScript isn’t statically typed

Like Python and Ruby, JavaScript is dynamically typed, which is convenient. But you can get into trouble. Here I intend for exampleArray to be an array. I set its values, then check its length — meaning the number of elements it contains.

exampleArray = [1, 2]
-> [1, 2]
-> 2

But then I accidentally assign it to be a string.

exampleArray = “text”
-> “text”
-> 4

These kinds of errors happen all the time in dynamically typed languages.Most developers just put checks in place to prevent them, and write tests accordingly.

If you absolutely must have static typing in your first programming language, then I still recommend you learn JavaScript first. Then you can quickly pick up TypeScript.

“Typescript has a learning curve, but if you already know JavaScript, it will be a smooth one.” — Alex Ewerlöf on TypeScript

Objection #3: But I really want to make a mobile app

I still recommend learning JavaScript first.

  1. JavaScript features several tools for making native mobile apps, such as Angular Cordova and React Native.
  2. In order for your mobile app to actually do anything interesting, it will probably need a proper back end, which you’ll want to build with a proper web development framework, like Node.js + Express.js.

Also, it’s worth pointing out that the mobile app development’s best days may very well be behind it.

About 50% of respondents identify as full-stack developers, and about 17% consider themselves mobile developers. The median number of developer type identifications per respondent this year is 3, and the most common pairs are combinations of back-end, front-end, and full-stack developer. Pairs that are highly correlated include database administrator and system administrator, DevOps specialist and site reliability engineer, academic researcher and scientist, and designer and front-end developer.

The occupations of 81,335 responses, based on responses to the 2019 Stack Overflow survey.

The grand vision of “there’s an app for that” has not come to pass. Instead, most smartphone owners have stopped downloading new apps.

Sure — they still use apps. Mostly Facebook, Google Maps, and handful of others. As such, much of the demand for mobile app developers is concentrated in a few large employers.

The outlook for those mobile development jobs is hard to forecast. Many aspects of developing, maintaining, and distributing mobile apps are easier with JavaScript. So companies like Facebook and Google are investing heavily in better tools for building these using JavaScript.

As of 2019, pretty much all development is web development. Everything touches that big platform that is “the web.” And the next wave of devices that you’ll talk to around your home, and cars that pick your kids up from school — they’ll all be piped together using the web, too.

And that means JavaScript.

Objection #4: Isn’t JavaScript a toy language that was written in 10 days?

JavaScript has a quirky history.

You will undoubtedly hear people crack jokes at its expense.

Well people love to hate on C++, too. And like JavaScript, C++ has succeeded despite this hate, and now it’s pretty much everywhere as well.

So if anybody ever gives you a hard time for learning JavaScript instead of elite-language-of-the-week, just remember the famous words of the guy who created C++:

“There are only two kinds of programming languages: those people always bitch about and those nobody uses.” — Bjarne Stroustrup

Previous Article
Next Article

Buy Me a Coffee