JavaScript vs TypeScript


What is JavaScript?

  • Netscape developed it in 1995.
  • Javascript (JS) is a scripting languages, primarily used on the Web.
  • It is a high-level, interpreted language - that can easily be added with languages like HTML.
  • JavaScript is an interpreted language. So it doesn't need to be compiled the JavaScript code. It run directly on browser.
  • JavaScript is an object-based scripting programming language. It is lightweight which consume minimal memory resources when its code or an application is running and cross-platform.
  • EcmaScript2022 (ES13) is latest JavaScript version going to release in 2022 year.
  • JavaScript can be use with developing following applications: Websites, Web Applications, Server Applications, Games, Art, Mobile Apps

What is TypeScript?

  • Anders Hejlsberg developed it in 2012 at Microsoft. Anders Hejlsberg also designed C# at Microsoft.
  • TypeScript is a superset of JavaScript.
  • Object-Oriented language - It is object-oriented language with classes, interfaces and statically typed programming like C# or Java.
  • You will need a compiler to compile the code and generate the code in the JavaScript file(js file).
  • TypeScript is the ES6 version of JavaScript with some additional features with classes, interfaces, inheritance, generics etc .
  • A TypeScript code is written in a file which have.ts extension.
  • TypeScript supports JavaScript libraries - It allows the developers to use existing JavaScript code with the TypeScript. So it support all of the JavaScript frameworks, tools, and other libraries easily.
  • JavaScript is TypeScript - The code written in JavaScript with valid .js extension can be converted to TypeScript by changing the extension from .js to .ts and compiled with other TypeScript files.
  • TypeScript is portable - Execute on any browsers, devices, or any operating systems.
  • DOM Manipulation - To manipulate the DOM for adding or removing elements similar to JavaScript.

Difference between the JavaScript & TypeScript

SNo. JavaScript TypeScript
1 It is developed by Netscape in 1995. It is developed by Anders Hejlsberg in 2012.
2 JavaScript source file is in .js extension. TyTypeScript source file is in .ts extension.
3 It is just a scripting language. It supports object-oriented programming concept like classes, interfaces, inheritance, generics, etc.
4 It doesn't support strongly typed or static typing. It supports strongly typed or static typing feature.
5 It doesn't support optional parameters. It supports optional parameters.
6 It is interpreted language that's why it highlighted the errors at runtime. ItIt compiles the code and highlighted errors during the development time at compile time.
7 JavaScript doesn't support generics. JavaScript supports generics.

Prev Next