256 Kilobytes

JavaScript vs. ECMAScript vs. TypeScript vs. CoffeeScript - Differences, what to use, and when

Articles in Web Development | By Huevos Rancheros

Published 1 year agoSat, 22 Dec 2018 20:28:52 -0800 | Last update 1 year agoSat, 22 Dec 2018 20:39:39 -0800

853 views, 1 RAM, and 0 comments

What is each of these

JavaScript – JS is a high-level programming language. It is one of the three main technologies of the Web, along with HTML and CSS.

ECMAScript – This is the standard for JavaScript. Basically, JS and Ecma are the same thing – the only reason ECMAScript was created was to standardize JavaScript, in order to promote independent implementations.

TypeScript – An open-source programming language and a superset of JavaScript, with strict syntax. Think of it as a way to write “good practice” JavaScript. It compiles down to JavaScript, and it was created and currently developed by Microsoft, but the best thing to happen to it was probably Google’s Angular (you can check out my article on learning Angular as fast as possible), as that promoted its widespread use quite a bit.

CoffeeScript – Much like TypeScript, CoffeeScript also compiles to JavaScript, and it adds a bunch of syntactic sugar on top of it. It never went “viral” though, so it was never as popular as TypeScript now is.

JavaScript VS ECMASctipt

The main thing that all four of these share is JavaScript. ECMAScript is the standard, and both TypeScript and CoffeeScript are supersets of JS that compile to it.

As I already said, ECMAScript is a trademarked scripting language specification by ECMA International. The ECMAScript standard comes in versions, the current being ECMAScript 9, officially known as ECMAScript 2018. You will hear about versions a lot when working with JavaScript. For example - arrow functions, Promises, let and const (instead of just var) were all added with ES6.

When using different ECMAScript standard versions with JavaScript, keep in mind that some browsers may not offer support for the newest version yet – and, things will probably not work with older browsers.

I’m not going to talk about ECMAScript much more, since that’s basically just the JS standard, there isn’t much else to say about it.

So, what are the differences between JavaScript, TypeScript, and CoffeeScript?

JavaScript VS TypeScript

JavaScript, also sometimes referred to as “vanilla JavaScript” (when used without syntactic sugar) is lightweight and isn’t very strict. It can be used on both client and server-side.

While it was originally developed to be used for client-side only, its flexibility and wide-spread use lead to innovative solutions that allowed developers to use it as a server-side as well. The server-side history of JavaScript is an interesting one, but all you need to know about it at this point in time is that the first attempt to use it as a server-side language was with Netscape Enterprise Server, while the currently most popular one is NodeJS, which has recently skyrocketed in both popularity and developer jobs available.

Knowing JavaScript is a must for any web developer, and considering its widespread use with NodeJS, the language is now more useful than ever and probably the most famous programming language out there.

Just like JS, TypeScript can be used on the server side with NodeJS as well. As I already said, TypeScript is a superset of JavaScript, meaning it “expands” it, so to speak. Also, any valid JS code will also work in TypeScript by default, making the TS learning curve almost non-existent, since you can just start by using JS and slowly grow into being comfortable with TS.

Basically, considering that TS make you write code a certain way, you will have to write a little more code upfront – however, that will save a lot of time later on as your project grows. One of the biggest benefits is just Tooling, which gives you errors right in your IDE as you write them, instead of production. This means that you can fix things one by one as you go, instead of having it all blow in your face during production.

Overall, while far from mandatory, if you do use JS a lot in your projects, then learning TypeScript might be a worthwhile investment that will yield a return as you go.

JavaScript VS CoffeeScript

CoffeeScript is technically its own nice little language that basically tells you what you can and can’t do with JavaScript. While it was one of the first “compile-into-JavaScript” ideas, you could say that they’ve sort of failed to keep up and

All in all, CoffeeScript is what many consider “simplified JavaScript” - everything in CS is an expression, and the last one in a function is actually its return value. This may sound confusing to some JavaScript developers, but it should be pretty close to how Python and Ruby developers get things done. That also makes it easier to learn and much more convenient if you come from a Python or Ruby background.

However, CoffeeScript is about 10 times less popular now than at its peak in 2013. That means its likely this language is dyeing out and won’t be anywhere near as popular as it was anytime soon. Take a look at the Google Trends graph below:

Still, if you’re looking to make coding JavaScript easier and also want to keep your code cleaner and more concise with plenty of syntactic sugar, CoffeeScript is still a viable option, albeit perhaps for not too long.

TypeScript VS CoffeeScript

Unlike CoffeeScript, TypeScript is actually getting more and more popular, especially with Angular and all of its new versions coming out. You could perhaps say that not that many people actually chose to use TypeScript, but it was forced upon them with Angular, whether it was because of a job requirement or a client who wanted to use Angular. Either way, we’re now stuck with it, for better or for worse.

Now, which is better – TypeScript, or CoffeeScript? The answer, as always, is – it depends. If you’re comfortable using Ruby and Python and you’re working on a more of a one time project type thing, then CoffeeScript might be a good option, as an easier-to-read type of JavaScript. That’s even their slogan – “it’s just JavaScript. Still, many people would say CoffeeScript has been that ever since ES6 came along, so keep that in mind. If you’re looking for something that will be useful in the future, CoffeeScript is probably not really it.

In case you know you will need TypeScript (or Angular) at some point of your career, and would rather use something that’s getting more and more popular and thus has a better community, then TypeScript is the way to go. That also goes if you want to raise your value as a employee – a lot of opportunities for TypeScript developers, both front-end and back-end. Not so many for CoffeeScript, though/

When to use each

If you don’t know JavaScript, it would be very wise to start with that first before you get to using any of the supersets. There are plenty of course and resources on it and it shouldn’t take you more than a few days to pick up.

As I already said, ECMAScript is just the standard for JavaScript – a different name, if you will. So, not much use in talking “when to use it”.

TypeScript, on the other hand, is the superset that’s been gaining popularity, with a large community, plenty of resources and documentation, and maintained by Microsoft and promoted by Google. It’s really the safe choice when it comes to picking something to expand your programming skillset with. Not only will there be jobs available in the next few years, it’s likely that it will become a bit of a standard and further grow as a language.

You should also use TypeScript if you’re looking for good tool chain support, static type checking, and if you need to use old JavaScript code in your project(s).

If, again, you want to have cleaner code with some syntactic sugar, and/or come from a Python or Ruby background, then use CoffeeScript. However, many would claim is already dead, so if you do decide to use it, make sure you know your why and your other options. While there are still thousands of CoffeeScript projects that need  maintenance, it is almost certain that any demand for it will slowly die off and become obsolete.


JavaScript: Learn it anyway, it’s what all the others have in common and a ton of demand for it (or at least gives you a solid foundation to build on).

TypeScript: Use if you want to make things easier for bigger or cooperative projects. Very popular and possibly here to stay

CoffeeScript: Probably already dead, you may want to think twice if you decide to opt for CS instead of TypeScript.

Users Who Have Downloaded More RAM:
August R. Garcia (1 year ago)
🐏 ⨉ 1
Posted by Huevos Rancheros 1 year ago

Edit History

• [2018-12-22 20:28 PST] Huevos Rancheros (1 year ago)
• [2018-12-22 20:28 PST] Huevos Rancheros (1 year ago)
• [2018-12-22 20:28 PST] Huevos Rancheros (1 year ago)
• [2018-12-22 20:28 PST] Huevos Rancheros (1 year ago)
🕓 Posted at 22 December, 2018 20:28 PM PST
Profile Photo - Huevos Rancheros Huevos Rancheros
🗎 24 🗨 110 🐏 66

I sell rare words

Account created 1 year ago.
24 posts, 110 comments, and 66 RAMs.

Last active 1 week ago:
Commented in thread Capitalising on the new Google layout

Post a New Comment

To leave a comment, login to your account or create an account.

Do you like having a good time?

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account
You can also login to an existing account or recover your password. All use of this site is subject to terms outlined in the terms of service and privacy policy.