Yogesh Chauhan's Blog

What are Identifiers in JavaScript?

in JavaScript on April 30, 2020

An identifier is simply a name.

An identifier is a sequence of characters in the code that identifies a variable, function, or property.

In JavaScript, identifiers are used to name variables and functions and to provide labels for certain loops in JavaScript code.

Identifiers are case-sensitive and can contain Unicode letters, $, _, and digits (0-9), but may not start with a digit.

Subsequent characters can be letters, digits, underscores, or dollar signs.

Digits are not allowed as the first character so that JavaScript can easily distinguish identifiers from numbers.

These are all legal identifiers:


For portability and ease of editing, it is common to use only ASCII letters and digits in identifiers.

Note, however, that JavaScript allows identifiers to contain letters and digits from the entire Unicode character set. This allows programmers to use variable names from non-English languages and also to use mathematical symbols:

var sí = true;
var π = 3.14;

Like any language, JavaScript reserves certain identifiers for use by the language itself. These “reserved words” cannot be used as regular identifiers.

An identifier differs from a string in that a string is data, while an identifier is part of the code. In JavaScript, there is no way to convert identifiers to strings, but sometimes it is possible to parse strings into identifiers.


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
Open Source Security Tools for Defense SecurityMiscellaneousHow to Find the Highest (or Lowest) Number in an Array in JavaScript?JavaScriptJSON.stringify() in JavaScriptJavaScriptHow to Install PHP Laravel on MacOS Catalina?PHPHow to modify AutoSave Interval using code in WordPress?WordPress3 JavaScript methods to use when you want to go back and forth in historyJavaScript