Syntax error What are JavaScript Identifiers?

What are JavaScript Identifiers?



JavaScript Identifiers are names given to variables, functions, etc. It is the same as identifiers in other programming languages like C, C++, Java, etc. Let’s see identifiers for variable names.

The following are legal variable names −

val
val1
result

While naming your variables in JavaScript, keep the following rules in mind.

  • You should not use any of the JavaScript reserved keywords as a variable name. These keywords are mentioned in the next section. For example, break or boolean variable names are not valid.
  • JavaScript variable names should not start with a numeral (0-9). They must begin with a letter or an underscore character. For example, 5demo is an invalid variable name but _5demo is a valid one.
  • JavaScript variable names are case-sensitive. For example, Name and name are two different variables.
Updated on: 2020-06-23T06:44:09+05:30

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements