FrontendDeveloper.in

JavaScript question detail

What is typescript

TypeScript is a typed superset of JavaScript created by Microsoft that adds optional types, classes and many other features, and compiles to plain JavaScript. Angular is built entirely in TypeScript and it is used as the primary language there. You can install it globally as

npm install -g typescript

Let's see a simple example of TypeScript usage,

function greeting(name: string): string {
return "Hello, " + name;
}

let user = "Sudheer";

console.log(greeting(user));

The greeting method allows only string type as argument.

Back to all JavaScript questions
Get LinkedIn Premium at Rs 399