Why JavaScript?

I'm mostly a pythonista, though many people keep trolling asking me why I'm doing JavaScript, oh boy, such a language that sucks. I'm putting this blog post here to address this question once for all, let me hope.

Since 15 years, I've been learning Perl, PHP, JavaScript, Python, JavaScript, Clojure, a tiny bit of Ruby, Haskell & Erlang for educational purpose, and JavaScript.

Wait a minute, JavaScript is mentioned THREE times, you mad.

Yep, JavaScript — like many other programming languages probably — is one you have to learn three times to be proficient with it. The first time, to hate it. The second time, to start appreciating it. The third time, to understand it and get shit actually done.

Now some facts:

You're free not to like JavaScript or to find it dumb. You're encouraged to let other people take the time to learn it and get shit done with it.

So:

  • Is JavaScript a usable language? Yes.
  • Is JavaScript suited for all possible usages? Nope.
  • Do you have to continuously rant about it? Probably not.
  • Do you have to troll & mock people doing JavaScript? Stop doing that now.
  • Do you have to learn JavaScript before criticizing it? Definitely.

The problem many people have with JavaScript is they don't like it but want to join the browser party so badly — especially since even cool operating systems plan to use it extensively. They would just love having their Python, Ruby, Haskell, Erlang, Java, C#, COBOL, <insert your favorite language here> being the default standardized language to code frontend webapps in a DOM environment. Unfortunately, that's not the case; JavaScript is the default language to manipulate the DOM in browsers and make things happen. And it's not likely to change anytime soon imho. But I've got good news for you: alternatives exist.

As an exciting side note, the next version of JavaScript, ECMAScript 6, will definitely step up from the previous version.

Also, a cool idea I heard would be to have a low-level compilation target platform in browsers in order to code your next website in other languages than JavaScript but with great, native performance. Having a bit what the JVM is to Java and other languages running on it. That would be smart and definitely interesting. But one more time, it's not likely to happen soon.

In the meanwhile, JavaScript is the language of the Web, and JavaScript engines are its running platform. There are better languages, there are worse. One thing is crystal clear: great, innovative & useful stuff can be achieved with it, you may want to be part of the move.

And as always, remember that:

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