Why JavaScript Is The Next (or first) Programming Language You Should Learn

I’ve been asked a few times recently what programming language I’d learn if I was just starting out. Right now, the answer is definitely JavaScript, and here’s why:

Easiest Development Environment

I believe one of the biggest hurdles for people to get into programming is actually all of the other stuff around just writing code. Anything you can do to get to the point where you’re writing code faster (at least while you’re learning) is a win in my mind. Everyone has access to a web browser, which means everyone now has access to a simple development environment. If you’re using Chrome on a Mac, press cmd-opt-j. Welcome to the console, you’re now able to start writing JavaScript to manipulate the page you’re looking at. That’s pretty awesome. There are also a bunch of online editors and tools like CodePen, JSFiddle which allow you to dive into a more complete development/testing/prototyping environment right in your browser.

Simple

JavaScript makes it really easy to write simple code when you’re getting started, which is perfectly valid. Define a function, call it. Make a loop. Ignore the DOM (in fact, ignore the web almost entirely) and focus on simple logic and code. Start building objects and arrays. The OO-model in JS can be a little weird (especially around classes and inheritance), but that’s OK, you’re going to need to be flexible if you’re going to be a developer anyway. Once you get the basics figured out, you can start diving deeper and discover the full power of JavaScript.

Flexible

The flip side of the previous argument is that JavaScript is also super flexible (arguably too much so!). Once you move on from a few functions embedded directly in script tags in your page to manipulate an image or a menu, you can quickly move towards a fully-architected web application with many files, larger object/class-style structures, complex single-page-applications and a whole lot more. JavaScript actually scales up quite nicely to handle bigger challenges, and is ideally suited to web applications, since it’s so tightly integrated with the DOM and the browser.

Web-native

As much as native mobile app developers would have you believe that apps are the future, I still think that open web technologies are the key to the future. Give it a little time, and we’ll mostly be writing all of our mobile apps in HTML/JS, and deploying them in wrapper-apps to our phones. I consider this basically inevitable. Learning to develop for the web is super important. You’ll need to know it basically regardless of what main language you’re working with, because despite our best efforts, you will still end up manipulating CSS, tweaking some HTML tags, etc. That’s not going to go away any time soon I don’t think.

Inevitable

This is pretty far down the list, but that’s mainly because of a thought progression more than anything else. I actually see this as a really important reason for why you should learn JavaScript. Here’s the deal — if you want to develop things for the web, you will end up writing JavaScript. There’s no avoiding it. There’s only so much you can do with a server-side language (PHP, Python, Ruby). At some point, your payload is delivered to a browser, and if you want to do anything remotely interesting there, you have to do it in JavaScript. So if you’re going to have to learn it anyway, why not optimize that process (and perhaps use JS in more places, rather than less?).

Portable (browser/server/native)

Now that we have things like Node.js, JavaScript has moved beyond the browser. Not only can you write server-side JS (so you can build the front and back-end of your web application in JS), you can also use something like node-webkit to bundle it up into a distributable desktop application, or use PhoneGap to package it as a mobile app for any platform. No other language can match that portability right now.

Toolchain

If all of the above wasn’t enough, the exploding JavaScript community has really come a long way in the last few years as far as the developer’s toolchain goes. While we might not have the integrated, one-stop-shop approach of something like XCode for Mac developers, we have tools like Grunt and Gulp which allow us to build our own asset pipelines. Every code editor known to man has support for JavaScript syntax highlighting and linting, and we don’t need a build process like other languages, so we’re lighter on our feet anyway. There’s also a bunch of tools for testing; everything from unit tests to functional tests, to fully automated simulations of users-in-browsers.

So anyway — there’s never been a better time to get started with coding, and if you’re going to do it, I suggest starting with JavaScript. Start small, work your way up. View Source. Get on Github. Go nuts.

  1. RT @beaulebens: Why JavaScript Is The Next (or fir… | Jtsternberg Tweets

      • raydawg88 said:

        It’s actually not the language that has been a problem for me. As you know, I’ve been trying to teach myself for years now. The problem I have, and I wonder if it’s the same for most, is that I don’t want to learn basics. I want to learn how to build an idea or something that I have interest in.

        When I taught myself guitar, I learned a song that I knew. Same for when I learned to draw. I would draw cartoon characters that I know.

        The problem I see with learning to code practices, is that they take the book process. Chapter 1 through 10. VS taking pieces from each to make a “thing”

        Or maybe I’m just dumb.

        • Beau said:

          That’s a symptom of some of the more basic, and more poorly produced learning environments, to be honest. Things like Khan Academy and Code School are taking a much more “build a thing” type approach now, even if it’s a much simpler thing. The reality is that this stuff is complex, and there is a lot going on, just to build some idea that you think is simple. The technology and tools are getting better though, so while the environment is actually getting more complex, I think the tools abstract that out a bit so that it’s easier in some ways to get started/become a coder than it has been previously.

  2. julien51 said:

    The story of JS is itself fascinating and shows that it’s easier for languages to go “down the stack” (from the browser down to the OS) than the other way around.

  3. You Should Learn JavaScript | WiebePress

  4. 为什么JavaScript是你应当学习的下一个(或第一个)编程语言 | 腊八粥

  5. Randy said:

    Hmm. Shouldn’t you first be asking yourself why you want to learn a programming language and what you hope to learn from the experience before picking a specific language? While the tools for using Javascript in environments other than the browser have greatly improved, I’d be leery of blindly using it as a beginners first language without seriously considering other options.

    More importantly there is much more to programming than simply learning “how to code”. Javascript has always suffered from the ‘hurry hurry I want to build’ something syndrome without the subsequent deeper understanding of what is going on. Things are also changing a bit in that regard with a few more competent and complete Javascript programming books + training becoming available (especially true for those with some previous programming experience). However other languages offer a far more encompasing environment for really learning ‘programmiing’ versus ‘coding’.

    • Beau said:

      Sure, depending on what you want to *do* with a programming language should help you decide what language to learn, but if you have to start somewhere, then I think JavaScript is a reasonable place to start at least learning some concepts and logic structures and whatnot.

      I don’t think there’s anything at all wrong with starting with a “hurry hurry I want to build” attitude when getting started. Trying to force a “deeper understanding” of things from day one is just going to turn most people off, and unnecessarily confuse them. The reality is that as time progresses, you need to know less and less of what’s going on “under the hood” to build something simple. Not to say that this approach is going to make you a hardcore, life-long (or even particularly great) developer, but it might just get people started enough to find out if that is something that interests them, and I think that’s a Good Thing.

  6. 122 JSJ Socket.IO with Guillermo Rauch

Comments are closed.