liveBook · Manning

Identifier

As explained in Secrets of the JavaScript Ninja, Second Edition

A name used to identify an entity in a program.

An identifier is a name used to identify an entity in a program. JavaScript examples use names such as WeaponGenerator and weapon alongside variable declarations and loops. section 5.5 section 6.2

Listing 6.1. Using a generator function to generate a sequence of values
function* WeaponGenerator(){                #A
  yield "Katana";                           #B
  yield "Wakizashi";                        #B
  yield "Kusarigama";                       #B
}

for(let weapon of WeaponGenerator()) {        #C
  assert(weapon !== undefined, weapon);       #C
}                                             #C

The generator listing shows identifiers in context: WeaponGenerator names the generator, and weapon names the loop variable. section 6.2

How Secrets of the JavaScript Ninja, Second Edition covers it

How deep it goes
Receives contextual examples but no treatment of identifier naming rules or syntax.
Examples
Uses WeaponGenerator and weapon in a loop over the yielded values Katana, Wakizashi, and Kusarigama.
How it connects
Connects identifiers with variable declarations, lexical environments, generator functions, and for-of loops.

Also explained in

Compare how 5 books explain identifier →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Second Edition. The section links point to the parts of the book it draws on.