TypeScript Vs JavaScript: What is the Difference?

In this article, we will see the comparison of typescript vs javascript with advantages and disadvantages.

What is JavaScript

JavaScript is the most widely use HTML and Web programming language. JavaScript is a lightweight, cross-platform object-based programming language. It’s use to make dynamic client-side pages. Scripts are programs written in the JavaScript programming language. The scripts are embed in HTML pages and run in the background when the page loads. It is deliver and perform as plain text, and no extra preparation or compilation is require to run it.

History of JavaScript

Brendan Eich, a programmer at Netscape Communications Corporation, created JavaScript. It was first released in September 1995 under the name Mocha. However, it was renamed JavaScript to reflect Netscape’s use of Java within its browser as it gained prominence as the greatest scripting language. Netscape submitted JavaScript to ECMA in November 1996. (European Computer Manufacturers Association). ECMAScript 2019, which was release in June 2019, is the most recent version of JavaScript.

What is TypeScript

TypeScript is an object-oriented programming language that is free and open-source. It’s a superset of JavaScript that’s highly typed and compiles to ordinary JavaScript. Microsoft created and maintains TypeScript under the Apache 2 license. It is not a browser-based application. To compile and produce a JavaScript file, you’ll need a compiler. The “.ts” suffix refers to the TypeScript source file. By renaming any valid “.js” file to “.ts” we may utilize it. TypeScript is an ES6-based version of JavaScript with a few more capabilities.

History of TypeScript

The typeScript was create by Anders Hejlsberg. It was originally made available to the general public on October 1, 2012. The latest version of TypeScript 0.9 was publish in 2013  after two years of internal development at Microsoft. TypeScript 4.5.4, which was publish on 13 December 2021, is the most recent version.

TypeScript Vs JavaScript

01It doesn’t support strongly typed or static typing.It supports strongly typed or static typing features.
02Netscape developed it in 1995.Anders Hejlsberg developed it in 2012.
03JavaScript source file is in “.js” extension.TypeScript source file is in “.ts” extension.
04It is directly run on the browser.It is not directly run on the browser.
05It is just a scripting language.It supports object-oriented programming concepts like classes, interfaces, inheritance, generics, etc.
06It doesn’t support optional parameters.It supports optional parameters.
07It is interpreted language that’s why it highlighted the errors at runtime.It compiles the code and highlighted errors during the development time.
08JavaScript doesn’t support modules.TypeScript gives support for modules.
09In this, numbers, strings are the objects.In this, number, string are the interface.
10JavaScript doesn’t support generics.TypeScript supports generics.

Code Example of JavaScript:

function addNumbers(a, b) {  
    return a + b;  
var sum = addNumbers(15, 25);  
document.write('Sum of the numbers is: ' + sum); 

Code Example of TypeScript:

function addNumbers(a, b) {  
    return a + b;  
var sum = addNumbers(15, 25);  
console.log('Sum of the numbers is: ' + sum );

Advantage of TypeScript over JavaScript

  • During development, TypeScript always indicates faults at compilation time, whereas JavaScript reveals issues at runtime.
  • TypeScript allows highly typed or static typing, whereas this is not in JavaScript.
  • Any browser or JavaScript engine can execute TypeScript.
  • Great tooling supports with IntelliSense which provides active hints as the code is added.
  • It has a namespace concept by defining a module.

Disadvantage of TypeScript over JavaScript

  • The compilation of TypeScript code takes a lengthy time.
  • Abstract classes are not support by TypeScript.
  • If we launch the TypeScript program in the browser, we’ll need to compile it first to convert it to JavaScript.


When comparing the pros and downsides of typescript vs javascript, it can be concluded that both technologies have advantages and disadvantages. Although JavaScript is not a complete coding language, it is used in conjunction with HTML to improve the quality of online pages. In addition, JavaScript is used by thousands of professional developers.

TypeScript, on the other hand, is the language of choice for developers who want to write clean, elegant, concise, and readable code. Not to mention TypeScript’s benefits in terms of live error checking and static typing.

That’s all for this article if you have any confusion contact us through our website or email us at [email protected] or by using LinkedIn

Suggested Articles:

  1. ES5 vs ES6 ( With example code )
  2. ES6 Syntax and Feature Overview
  3. Top 10 ES6 features by example

Leave a Comment