Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Identifiers and Keywords in TypeScript

  • Last Updated : 19 Feb, 2019

Identifiers: Identifiers are nothing but the names which is given to the members of any class like a variable, method name, class name, array name etc. Certain rules to be followed while declaring Identifiers:

  • Identifier name can start with both upper-case as well as lower case letter but can’t start with numbers.
  • Only _ and $ symbols can be used for giving name to Identifiers, apart from these symbols, no other special symbol can be used.
  • Keywords are different from Identifiers.
  • Identifier are case sensitive and doesn’t contain spaces.

Examples of Valid and Invalid Identifiers:

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

ValidInvalid
geeksforgeeks1$geeksforgeeks
geeks_for_geeks#geeks
$geeksgeeks-for-geeks
_geeks$any

Keywords: Keywords are words which are responsible to perform some specific task or the words which represent some specific functionality. The following table lists some keywords:

breakasanyswitchcaseif
throwelsevarnumberstringget
moduletypeinstanceoftypeofpublicprivate

Comments: Comments are a way to improve the readability of a program. While coding we use comments for a better understanding of code for other users. While execution of the code, compiler ignore the comments and compile the rest of the code. There are two ways to use comments :

  • Single-line comments ( // )
  • Multi-line comments (/* */)

Examples:

  • Hello World in TypeScript
    My Personal Notes arrow_drop_up
  • Recommended Articles
    Page :