Introduction
In this blog, we are going to see about the difference between TypeScript and JavaScript. JavaScript is a scripting language that is used for both client-side and server-side programming languages. JavaScript is complex and heavy for large-scale applications and also not able to full fill the requirement of OOP concepts in server-side programming. So, TypeScript was developed to fulfill this gap.
Difference between TypeScript and JavaScript
| TypeScript | JavaScript |
| File Extension is .ts or .tsx. | File Extension is .js. |
| It is an object-oriented programming language. | It is a scripting language. |
| Typescript is strongly typed and it supports both static and dynamic typing. | There is no static typing. Its dynamic language. |
We can declare a variable with data types.
|
JavaScript doesn’t have data types, so we cannot declare variables the same as TypeScript. |
TypeScript supports modules.
|
JavaScript doesn’t support modules. |
TypeScript has Types and Interfaces.
|
No concept of types and interface in JavaScript. |
TypeScript supports optional parameter function.
|
JavaScript has no optional parameter function. |
TypeScript supports function overloading.
|
JavaScript doesn’t support function overloading. |
| TypeScript supports generics. | JavaScript doesn't support generics. |
| It supports data type. So we can avoid run time error due to assigning the invalid type of values to the variable. | It doesn’t support data type. So could possible to assign an invalid value assigned to the variable. |
| It compiles the code and highlighted errors during the compile time itself. | It is interpreted language. So, it is highlighted the errors only on runtime. |
Sample for TypeScript
|
Example for JavaScript
|
| It is a superset of JavaScript, developed to overcome code complexity for large projects. | It helps create dynamic web page content. |
| It is not directly run on the browser. It will be converted into JavaScript code to be understandable for browsers. | It is directly run on browsers |
| In TypeScript, numbers and strings are the interfaces. | In JavaScript, numbers and strings are the objects. |
I hope you liked it and learned about the differences between TypeScript and JavaScript.

Sameer ShaikPosted Aug 13, 2021, 9:46 AM
JavaScript has no optional parameter function ?? is this correct ?
Jay Krishna ReddyPosted Aug 13, 2021, 6:33 AM
Thanks for the detailed article..!, Keep posting like this