In JavaScript, an identifier is the name that is given to variables, functions or properties to be able to refer to (or identify) them. In JavaScript, identifiers are case-sensitive and are governed by the following set of rules:
- They can contain unicode letters (or escape sequences),
$
,_
, or digits (0-9
); - They cannot start with a digit.
For example, the following are all valid identifies for variables, functions and object properties:
foo foo123 _foo_ $foo
As mentioned earlier, unicode characters or escape sequences are also valid identifiers. You can use these for variable, function or property names. For example, the following are all valid identifies for variables, functions and object properties:
\u0046\u006F\u006F fǾǾ
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.