Introduction to Typescript and Javascript
Posted By : Nutan Verma | 23-Dec-2020
Introduction
Features if Typescript
- Operating system (Linux, Windows,macOS) supports installation of Typescript
- We can write object-oriented code for client and server-side as it supports some features like Interfaces, classes, and modules
- We can find errors at the time of writing the code, without running the script, as it does Static Type checking
- We can use it for manipulating the DOM, like adding or removing the elements
- It includes features of ECMAScript 2015, which provide features of the class, Arrow function, interface
Components of Typescript
1)Language: It comprises elements like keyword, type annotations, and syntax
2)Typescript Compiler: It converts typescript to its javascript equivalent, it also does parsing and type checking of typescript code to javascript code
3)Typescript Language services: It exposes an additional layer around the core compiler pipeline, editor-like applications. It also supports some standard typical editor operations like colorization, statement completion, code formatting and outlining, signature help, etc. The language service supports the common set of typical editor operations.
Also Read: Overview Of Angular version 10
How static Typing works?
return num + 5
}
if we pass addFive("Hi")
, the function will return "Hi5"
or if pass addFive("5")
, the function will return "55"
return num + 5
}
- Typescript is an object-oriented language whearas javascript is the scripting language
- It has a feature named static typing whereas javascript doesn't have such feature
- Typescript gives support to module whereas javascript doesn't
- Typescript support operational parameter function whereas javascript doesn't
List of primitive data types in typescript
- Number
- String
- boolean
- Null
- Undefined
- Void
Also Read: Asynchronous Javascript
Declare a variable in Typescript
var
[identifier] : [type-annotation] = value; //Declaring type and value in a single statement
var
[identifier] : [type-annotation]; //Declaring type without value
var
[identifier] = value; //Declaring its value without type
var
[identifier]; //Declaring without value and type
We are a 360-degree software development company that provides complete web and mobile app development solutions for varied project requirements. Our end-to-end SaaS app development services address your mission-critical project requirements through scalable, responsive, and feature-rich software applications that are easy to scale. We carefully analyze your project requirements and formulate effective strategies to build enterprise-grade web and mobile applications for multiple platforms. For more info, contact us at [email protected].
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Nutan Verma
She works as a Frontend Developer. She keeps looking for challenges which demands the best of her professional ability in terms of technical, analytical skills. She is always energetic and competent.