JavaScript vs TypeScript

M.R.U.M. Senevirathna
2 min readFeb 9, 2021

Recently I started to learn Angular framework and while I was learning I had to learn about Typescript. While learning typescript I was more and more into TypeScript rather than JavaScript. Through this article I will briefly explain reasons behind why I became a fan of typescript in a short amount of time.

First typescript is not a whole different scripting language considering the JavaScript. If someone have already learned JavaScript and using java script for their projects they can learn Typescript in few days. Actually TypeScript is like a evolve version of JavaScript (super set of JavaScript).Any valid JavaScript code is a valid typescript code. So why then Typescript?. Typescript has additional feature more than JavaScript. So it helps developers to bake their codes in easy ways and to develop more accurate ,high valid projects.

examples for additional features:

Static typing : In TS Typing is optional. No need to specify type of variables etc.

object-oriented features: In Type script developer can use few object-oriented features like classes ,interfaces, access modifiers ,constructors etc.

compile time error checking :TS catch errors in compile time. Not all kind of errors but a lot.

For additional knowledge:

Browser which are generally use do not understand typescript codes. They only understand JavaScript codes. So TypeScript code must compile(translate) into JavaScript code using typescript compiler.

--

--