Life after JavaScript: The Benefits of Learning a 2nd Language

By Nilson Jacques

How many programming languages do you know? According to our recent survey, around 80% of readers know at least two. Well over half of you use PHP on a regular basis, and I’d be willing to bet a significant number started web development with the language, as did I.

Recently I decided it was time to think about adding another language to my resume (as if I didn’t have enough on my ‘to learn’ list already). I ended up working my way through an online Scala tutorial. For anyone who isn’t familiar with it, Scala is a general purpose compiled language (like Java, it compiles to portable bytecode) with static typing. Although like JavaScript it’s a multi-paradigm language, it has a lot of advanced functional programming (FP) features found in purely functional languages like Haskell. If the recent popularity of FP has struck a chord with you, there’s much in Scala to get your teeth into.

Silhouette of a person made from programming terms and language names

You might be thinking “Why would I want to start learning another language now? I’m planning to work with JavaScript for the foreseeable future!” You probably also have a laundry list of JavaScript related things to learn. There are some good reasons to consider picking up a new language, though. A good way to really get to grips with concepts, such as static typing, or programming paradigms, such as FP, is to work in a language that forces you to use those things. JavaScript’s flexibility is part of its appeal for a lot of people, but it also allows you to side-step certain problems. Learning to write idiomatic code for that language will teach you different ways of looking at and approaching problems that will change the way you write JavaScript. Additionally, having the language restrict you to programming in a certain style will really help you to understand its strengths and weaknesses.

Exposure to these new paradigms, concepts, and styles of programming can be especially useful for those of us who are self-taught and don’t have any formal training. Computer Science graduates are likely to have seen many of these ideas as part of their studies. To get the most benefit, consider studying languages that are quite different from JavaScript.

It’s worth mentioning, too, that some currently popular libraries and patterns are based on ideas drawn from other languages. Redux, a state management library for React, is based on the data flow system in Elm. Elm itself is a transpile-to-JS language inspired by Haskell! Learning other languages can help you better understand these libraries and the concepts behind them. By staying within your JavaScript comfort zone, you’re relying on others to bring these insights from other language ecosystems and present them in a digestible way.

Learning new languages can also affect the way you see your primary language. When I started learning Portuguese, it changed the way I looked at English. When you are confronted with different ways of doing things, it forces you to look at how those things work in your native language. Instead of taking things for granted, you start asking why things are done one way and not another. Depending on the language, you may see similarities; with Portuguese and English, some verbs are close enough for you to easily guess the meaning, thanks to their Latin origin. The same is true of programming languages, especially if you are still on your first. Exposure to other languages will help you to think about the design choices that were made when JavaScript was designed. A concrete example of this is learning a language that supports classical inheritance and being able to compare and contrast with JavaScript’s prototypal object system.

WebAssembly (WASM), an experimental low-level language, is soon to begin shipping in browsers. Higher-level languages, such as C and C++, will be able to compile to WASM and benefit from smaller file sizes and better performance than code written in JavaScript. This will open up the browser to other languages, and you can bet it won’t be long before many of the most popular ones are able to compile to WASM. JavaScript creator Brendan Eich recently said he could foresee the possibility of JavaScript becoming obsolete at some point in the future. In all likelihood, JavaScript will continue to be important for many years to come, but having another language under your belt certainly won’t hurt your employment prospects and may help to avoid you being pigeon-holed as a JavaScript developer.

If you really don’t have time to dedicate to learning a new language, you don’t have to stray too far from JavaScript to get some of the benefits I’ve mentioned. Last week we published the second part of our Angular 2 tutorial series, written entirely in TypeScript. TypeScript is a superset of JavaScript, so most of what you know still applies. It adds static typing and concepts like interfaces and decorators (the latter will be making its way into a future version of JavaScript). Setting aside some time to experiment with TypeScript will give an insight into the difference between statically and dynamically typed languages, and will broaden your knowledge and employability as a JavaScript developer. As the default language for Angular 2 development, job prospects are good, and the concepts you learn will make it easier to pick up a language like Java or Scala in the future.

Can you program in a language other than JavaScript? What would you recommend as good second language for a JavaScript developer? Will WebAssembly change the game? I’d love to hear your thoughts, so leave me a comment below!

  • Sina

    Just learn C/C++ then you will be able to program in any language, especially huge collection of C-like languages.

    • James Cat

      I’d add look into ocaml or Haskell to cover functional as well as procedural and object oriented paradigms. A difficult but worthwhile mind shift

  • Andrei T

    Like you, I also started my career with PHP we sites, over time I dropped it and focused just on JavaScript… I wonder though… – I speak fluent or proeficient​ in JavaScript nodejs CSS less HTML sass cofeescript typescript and a few others… How many does that count?

    I know, just one, but it feels .. wrong

  • markbrown4

    I code in three languages. JavaScript, CoffeeScript and ES6 ;)

    Totally agree, my time spent learning Ruby, Python and CoffeeScript have made me a better JavaScript developer.

  • If you are an experienced programmer, pick a new language is a question of weeks.

    • Nilson Jacques

      I don’t think it’s possible to generalize like that. The time taken to learn a new language will depend on different factors. If it has a small syntax, similar to a language you already know, that’ll obviously make it easier to pick up. If the new language contains a lot of unfamiliar concepts this also adds to the difficulty. I’ve seen several developers comment that they learned Go quite quickly, whereas Scala took them a lot longer as there was more to take on board.

  • John

    I miss cobol.

  • Lazar Ljubenovic

    Here’s a weird one: we learned (read: were forced to learn) Lisp in university for one semester and my JavaScript was boosted like 400%. It just made FP click because (as the article states) it just forces you to think that way. I don’t think I have written a for-loop in JavaScript ever since.

    So I probably won’t ever use Lisp again, but it was probably the most helpful language I’ve learned to this day because of what it opened up for me.

  • There is 3 points that extends JavaScript lifetime:

    1. While Web IDL, used to standardize Web APIs was first designed to be language agnostic, Web IDL 2 looks to be much more JavaScript dependent, and many Web API working group members think usage in JavaScript perspectives. For other languages to fully take over JavaScript, it will probably take time for them (natively or via libs) to comply with Web IDL 2 requirements or to wait for a Web IDL 3.

    2. Web Assembly engines relies on the JavaScript engine. As Brendan Eich says, it is too much complicated to have multiple engines in a browser, so any additional engine as to be integrated via the JavaScript engine. This makes JavaScript support stay for a moment. At worst, the language evolution will stop (some would prefer to say it will be stabilized)

    3. Websites and Web Applications Accessibility rely on HTML DOM attributes and many institutions or laws impose many of them to be accessible. Canvas rendering is already an issue on that point so I let you imagine with Web Assembly. In native development for desktop & mobile application, accessibility is provided by the main frameworks directly on the UI components and via dedicated APIs

    So, the way I see it, at least in first place, is that Web Assembly will allow to write very native comparable fast modules for time expensive Web applications (I would not be surprised to see wasm written frameworks for Web Developers).

    JavaScript developer roles will be less focus on writing some core framework like components and more focused on high level integrations. We may fear it will needs less competences but my guess is probably that it will require to focus on other kind of competences.

    Then, many Web developers may want to get back to more core features development and start using a language that compiles in Web Assembly, but which one?

    Brendan Eich said also that because of the dynamic nature of JavaScript, he did not see possible to compile JavaScript in Web Assembly any time soon, which means that such limitation probably applies to other loosely typed / interpreted languages (PHP? Python? Ruby? …). This will probably limit the number of people starting to use a language that compiles in Web Assembly.

    I think the first languages I’d be interested to work on are Rust, Swift, and then C#


    As supported by Mozilla which provides the Web Assembly compiler (emcc), I would not be surprised to see Rust as one of the first emcc supported languages. And even more now that Browser more and more support multi-threading (V8 & JSCore at least are thread-safe, web workers become more & more supported & SharedArrayBuffer is on the way). The concurrency optimizations of Rust could be interesting in this context. Note that Rust was used by Mozilla to write a whole new Browser called Servo, so it might help to expose Web APIs to this language more quickly.


    Developers I know that used Swift said its approaches move close to the JavaScript ones, and as being also the main language to code on Apple platforms (iPhone, iPad, Apple TV, upcoming Apple Car OS, …), it can be a good bet. Apple wanting to push its home made language, Web Assembly support could be an option for them to work on


    I’ve heard that Promises & async/await have been a lot inspired from the C# implementation so I guess Async development in C# should be quite optimized with probably a nice collection of Async oriented libraries. It is also one of the nearest languages from C/C++ and as one of the core component of the .NET framework, it is probably what Microsoft will push for.
    It also was standardized at ECMA but the last publications are unfortunately always outdated compared to the last versions. For this language, implementation still comes before standardization ;-)

    What about Go or Dart?

    The fourth main Browser actor being Google (I’m not talking about browser usage competition), It would be fair to say, even if Dart may be more close to JS, that I would also have a look at its Go language that it may push as a Web Assembly provider. But I don’t see that much advantages compared to the others


    While being able to compile JavaScript in Web Assembly would require a huge amount of work, what would it really be compared to the time required to oversee the current difficulties (Web APIs, Accessibility, …). So if JavaScript continues to evolve in the right direction with better qualities, it may still be there as a good interesting development languages once we will have unlimited other options. Who knows ? ;-)

Get the latest in JavaScript, once a week, for free.