Web Development Certification Training
- 5k Enrolled Learners
- Live Class
Having read about the basic definition and the features of the two, let’s now compare them and find out more about both the languages.
|Language||Scripting language||Object-oriented programming language|
|Learning Curve||Flexible and easy to learn||a programmer should have prior scripting knowledge|
|Type||Lightweight, interpreted programming language||Strongly type object-oriented programming language|
|Client/Server side||Both client and server-side||Specially used in client-side|
|File Extension||.js||. ts or .tsx|
|Time||Faster||Takes time to compile the code|
|Data Binding||No concept of types and interfaces available||Concepts like types and interfaces used to describe the data being used.|
|Annotations||Annotations not required||Code must be annotated constantly to get the most out of TypeScript Features.|
|Syntax||All the statements are written within the Script tag.|
|A TypeScript program is composed of:|
|Support for Modules||Does not support modules||Gives support for modules|
|Interface||Does not have an interface||Has an interface|
|Optional parameter function||Does not support||Supports|
|Prototyping Feature||Does not have any such feature||Has a feature of prototyping|
var message:string =“Hey People”console.log(message)
var message = “Hey People”; console.log(message);
First line declares a variable by the name message.
Second-line prints the variable’s value to the prompt.
Here, console refers to the terminal window and the function log () is used to display text on the screen.