TypeScript map is a new data structure that allows us to store data in a key-value pair and remembers the original insertion order of the keys.
TypeScript map is a new data structure that allows us to store data in the key-value pair and remembers the original insertion order of the keys. In the TypeScript map, we can use any value either as a key or as a value.
To create a map in TypeScript, use the following syntax.
let xmap = new Map();
To set a key-value in map, use map.set() function.
// app.ts let xmap = new Map(); xmap.set('name', 'Krunal'); console.log(xmap);
Go to the terminal where this file is and run the following command.
tsc --target es6 app.ts
Here, if we don’t add –target flag, then we will get an error because it won’t be compatible with ES6. So, we have to add this flag to avoid any error.
After running the command, you will see the new file is created called app.js and now run that file to get the output.
This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.
An ultimate guide to buying the best electric bikes/scooters for rental business or campus facility. It contains the list, prices, features, and specs.
An ultimate guide on how to start an electric sooter/bike rental business or faility/fleet in a university campus/IT park and expert recommendations.
Building a Web Application as a Front-End Developer using React JS and TypeScript! Learn how to use the “Thinking in React” method and apply it to your real web application. We will be using real live weather data to display in our application and make our components reusable and maintainable.