Sitemap
Kumarsmt

Kumarsmt

Identifiers in Javascript

2 min readJul 8, 2026

--

An identifier is a name used to identify a variable, function, class, or other programming element.

Get Kumarsmt’s stories in your inbox

Join Medium for free to get updates from this writer.

example:

//Variable Identifier

let firstNumber = 23;

let → keyword
firstNumber → Identifier
23 → value
// Function Identifier

#1
function greet(){
console.log("Welcome to JavaScript!!.");
}

function → keyword
greet → Identifier

#2
function multiply(a,b){
return a * b;
}

function → keyword
multiply → Identifier (function name)
a → Identifier (parameter)
b → Identifier (parameter)
return → keyword
* → arithmetic operator
// Class Identifier

class Person {}; //class → keyword and Persion → Identifier

// Object Identifier

const person = {
name: "Ram",
age: 23
}; // const → keyword and person → Identifier

Rules for Identifier’s Name:

  • Can contain letters ( a-z, A-Z ), digits ( 0–9 ), underscore( _ ), dollar ( $ ).
  • Must start with a letter, _, or $.
  • Cannot start with a number.
  • Cannot be a reserved keyword like ( for, const, let, if, ..).
  • Javascript identifiers are case-sensitive.
// Valid Identifiers
let rules;
let rule1;
let _rule;
let $rule;
let firstRule;
let first_rule;

//Invalid Indentifiers
let 1rule; // start with a number
let first-name; // hyphen (-) not allowed
let first.name; // dot (.) not allowed
let for; // reserved keyword
let class; // reserved keyword

Best Practices for Naming conventions:

  • Variables and functions → camelCase
let firstName;
let lastName;
let totalAmount;
let myNameIsRam;

function addAll {};
function calculateTotal {};
  • Constants → UPPER_SNAKE_CASE
const PI = 3.14159;
const MAX_USERS = 100;
const MIN_LENGTH = 8;
  • Classes → PascalCase
class Person {};
class UserProfile {};

--

--