Google News
logo
TypeScript - Interview Questions
What are Variables in TypeScript and how to create them?
A variable is a named space in the memory which is used to store values. The type syntax for declaring a variable in TypeScript includes a colon (:) after the variable name, followed by its type. Similar to JavaScript, we use the var keyword to declare a variable. While declaring a variable in Typescript, certain rules must be followed-
 
* The variable name must be an alphabet or numeric digits.
* You cannot start the name with digits.
* It cannot contain spaces and special characters, except the underscore(_) and the dollar($) sign.
Advertisement