What are the biggest myths about JavaScript?

Written by richardeng | Published 2018/09/04
Tech Story Tags: programming | javascript | javascript-myths | myths-about-javascript | biggest-javascript-myths

TLDRvia the TL;DR App

The biggest myth is that JavaScript is special or unique in terms of flexibility, expressiveness, and capabilities because of:

  • dynamic typing
  • lambdas
  • object prototypes
  • asynchronous programming

But guess what? It’s not unique at all!

Python, Ruby, Perl, PHP, Clojure, and Smalltalk are all dynamically typed.

Java, Python, C++, C#, Ruby, Perl, PHP, Scala, Clojure, and Smalltalk all support lambdas.

Maple, Self, Lua, REBOL, and Io all have object prototypes. Interestingly, other than JavaScript, nobody else gives a shit about prototypes. Class-based OOP remains, far and away, the most popular and widely used technique in the object space.

Asynchronous programming has been with us since the earliest days of computing. It can done in practically any language, including Java, Python, C#, and Smalltalk. What’s the big deal???

Anything you can do in JavaScript, I can do in Smalltalk, for example. If flexibility and expressiveness are the main reasons you’re using JavaScript, then you’re paying a high price for it because JavaScript is also an execrable language.

The second biggest myth is that you must use JavaScript for writing web browser applications because JavaScript is the only language native to the web browser. While this is technically true, you do have alternatives if you’re willing to accept transpiled languages. This means treating JavaScript as a kind of “assembly language” for the web.

This is no different from using a language like C or Go to compile into x86 assembly language.

Here is a short list of transpiled alternatives:

  • Bridge.NET (C#)
  • Cheerp (C++)
  • ClojureScript (Clojure)
  • Dart
  • Elm
  • GopherJS (Go)
  • Haxe
  • JSweet (Java)
  • Kotlin
  • Opal (Ruby)
  • PharoJS (Pharo)
  • Scala.js (Scala)
  • Transcrypt (Python)

You have a cornucopia of choice, an embarrassment of riches.

The third biggest myth is that JavaScript is easy to learn. Sure, if you limit yourself to a small language subset, then any programming language is easy to learn. This applies to C++, C#, Scala, and Swift, as well.

However, JavaScript is a HUGE language with numerous dark corners and weird edge cases. Don’t believe me? Look at ECMAScript 2017. Its language spec is over 885 pages long! This is getting into Tolstoy’s War and Peace territory.

Expect future versions of ECMAScript to be even bigger.

If you think JavaScript is easy to learn, then you are in for a rude surprise.

The fourth biggest myth is that JavaScript is the only language you can use for both front end and back end. Not if you’re willing to accept transpiled languages.

From the above list, the only languages that can’t be used for front and back ends are CoffeeScript and Elm.

The fifth biggest myth is that JavaScript is used everywhere. However, JavaScript is primarily used for front-end web development. It has some traction server-side with Node, and desktop-side with Electron, and mobile-side with React Native (as well as Cordova/PhoneGap). But everywhere else, JavaScript barely enjoys any usage.

It’s actually a similar story for languages like Python and Ruby. Both are quite versatile, but they really are best known for data science/machine learning and Rails, respectively. Python does well in the web space, too. But Python is hardly used for desktop and mobile.

Are front end, Node, Electron, and React Native everywhere? Talk about delusions!


Published by HackerNoon on 2018/09/04