Advertisement
728x90
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
bash
1npm install -g typescriptLet's see a simple example of TypeScript usage,
typescript
1function greeting(name: string): string {
2 return "Hello, " + name;
3 }
4
5let user = "Sudheer";
6
7console.log(greeting(user));The greeting method allows only string type as argument.
Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 81
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
252of476