Tuesday, November 19, 2024
Google search engine
HomeLanguagesJavascriptIdentifiers and Keywords in TypeScript

Identifiers and Keywords in TypeScript

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:

Valid Invalid
neveropen 1$neveropen
neveropen_for_neveropen #neveropen
$neveropen neveropen-for-neveropen
_neveropen$ 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:

break as any switch case if
throw else var number string get
module type instanceof typeof public private

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
  • Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

    RELATED ARTICLES

    Most Popular

    Recent Comments