Index

A note on the digital index

A link in an index entry is displayed as the section title in which that entry appears. Because some sections have multiple index markers, it is not unusual for an entry to have several links to the same section. Clicking on any link will take you directly to the place in the text in which the marker appears.

Symbols

! (exclamation mark)
!= (inequality) operator, Equality Operators, Equality Operators: === Versus ==, Lenient inequality (!=)
!== (strict inequality) operator, Equality Operators, Equality Operators: === Versus ==, Strict inequality (!==), Commonly Accepted Best Practices
checking for NaN, Pitfall: checking whether a value is NaN
logical NOT operator, Operators for Booleans and Numbers, Logical Not (!)
" " (quotation marks, double)
best practice in JavaScript, Commonly Accepted Best Practices
for string literals, Strings, String Literals
\$ (dollar sign)
in a replacement string, Test, Match, and Replace with Regular Expressions
% (percent sign)
%= compound assignment operator, Compound Assignment Operators
remainder operator, Operators, Arithmetic Operators, Arithmetic Operators
& (ampersand)
& (bitwise AND) operator, Operators for Booleans and Numbers, Binary Bitwise Operators
&& (logical AND) operator, Binary Logical Operators, Operators for Booleans and Numbers, Binary Logical Operators: And (&&) and Or (||), Logical And (&&)
&= (bitwise AND and assignment) operator, Compound Assignment Operators
' ' (quotation marks, single)
best practice in JavaScript, Commonly Accepted Best Practices
for string literals, Strings, String Literals
* (asterisk)
*= compound assignment operator, Compound Assignment Operators
multiplication operator, Operators, Arithmetic Operators
+ (plus sign)
++ (increment) operator, Operators, Arithmetic Operators, Increment operator
+= compound assignment operator, Compound Assignment Operators
+= operator, concatenating strings, String Operators
string concatenation operator, String Operators, Escaping in String Literals, Concatenation: The Plus (+) Operator
performance of, Concatenation: Joining an Array of String Fragments
, (comma) operator, The Comma Operator
- (minus sign)
-- (decrement operator), Increment operator
-- (decrement) operator, Operators, Arithmetic Operators
-= compound assignment operator, Compound Assignment Operators
negation operator, Operators, Arithmetic Operators
subtraction operator, Operators, Arithmetic Operators
. (comma), trailing commas in object literals and array literals, Syntactic Changes
. (dot operator), Values
calling methods with, Calling methods
using to access properties, Values, Dot Operator (.): Accessing Properties via Fixed Keys
working with objects, Cheat Sheet: Working with Objects
/ (slash)
/= compound assignment operator, Compound Assignment Operators
division operator, Operators, Arithmetic Operators
0 (zero), positive and negative, Two ZerosDistinguishing the two zeros
1TBS (One True Brace Style), 1TBS (One True Brace Style)
32-bit integers, Integers in JavaScript
signed, Signed 32-bit integers
via bitwise operators, 32-bit Integers via Bitwise Operators
64-bit precision, JavaScript numbers, The Internal Representation of Numbers
; (semicolon)
always using, best practice, Commonly Accepted Best Practices
in JavaScript code, Semicolons, Rules for Using SemicolonsPitfall: ASI might unexpectedly not be triggered
terminating semicolon for IIFEs, Introducing a New Scope via an IIFE
< (less than)
< (less than) operator, Ordering Operators, Comparing Strings
<< (bitwise left shift) operator, Operators for Booleans and Numbers, Shift operators, Bitwise Shift Operators
<<= (bitwise left shift and assignment operator), Compound Assignment Operators
<= (less than or equal to) operator, Ordering Operators, Comparing Strings
= (equals sign)
== (equality) operator, Equality Operators, Equality Operators: === Versus ==, Normal (Lenient) Equality (==, !=)
no valid use cases for, There Are No Valid Use Cases for ==
pitfalls of, Pitfall: lenient equality is different from conversion to boolean
=== (strict equality) operator, Equality Operators, Equality Operators: === Versus ==, Searching for Values (Nondestructive), Commonly Accepted Best Practices
checking for undefined or null values, Checking for null
checking if value is NaN, Pitfall: checking whether a value is NaN
object vs. primitive value comparisons, Primitive Values Versus Objects
assignment (=) versus equality comparison (===), An Overview of the Syntax, An Overview of the Syntax
assignment operator, Assignment Operators
setting object properties, Setting properties
> (greater than)
> (greater than) operator, Ordering Operators, Comparing Strings
>= (greater than or equal to) operator, Ordering Operators, Comparing Strings
>> (bitwise right shift) operator, Operators for Booleans and Numbers, Shift operators, Bitwise Shift Operators
>>= (bitwise right shift and assignment operator), Compound Assignment Operators
>>> (bitwise right shift with zero fill) operator, Operators for Booleans and Numbers, Shift operators, Bitwise Shift Operators
>>>= (bitwise right shift with zero fill and assignment operator), Compound Assignment Operators
? (question mark)
? : (conditional) operator, Conditional statement versus conditional expressions, The Conditional Operator ( ? : ), Comparing Numbers
enclosing in parentheses, Syntax
nesting, Conditional operator
[ ] (square brackets)
accessing array elements, Converting arguments to an Array
accessing characters in strings, Character Access
accessing single character in strings, Strings
bracket operator, Unusual Property Keys, Bracket Operator ([]): Accessing Properties via Computed Keys, Cheat Sheet: Working with Objects
computing a property key, Arbitrary Property Keys
creating arrays and accessing array elements, Array Literals
getting and setting a property, Arbitrary Property Keys
\ (backslash)
beginning character escape sequences, Escaping in String Literals
escaping characters in strings, Strings, Escaping in String Literals
{ } (curly braces)
enclosing blocks, Control Flow Statements and Blocks
in conditional and control flow statements, Conditionals
styles for, Brace Styles
using to prevent dangling else in if statements, Pitfall: dangling else
| (vertical bar)
bitwise OR operator, Operators for Booleans and Numbers, Binary Bitwise Operators
converting numbers to integers, Bitwise Or (|)
|= (bitwise OR and assignment) operator, Compound Assignment Operators
|| (logical OR) operator, Binary Logical Operators, Operators for Booleans and Numbers, Binary Logical Operators: And (&&) and Or (||), Logical Or (||), Optional Parameters
pattern, providing a default value, Pattern: providing a default value, Default values
~ (tilde)
bitwise NOT operator, Bitwise Not Operator
“single-line comments”), An Overview of the Syntax
‸ (bitwise XOR) operator, Operators for Booleans and Numbers

A

accessors, Kinds of Properties
and inheritance, Accessors and Inheritance
defining via an object literal, Defining Accessors via an Object Literal
defining via property descriptors, Defining Accessors via Property Descriptors
in ECMAScript 5, New Features
property attributes specific to, Property Attributes
Ajax, Historical JavaScript Milestones
Allman style (braces), Allman style
AMD (Asynchronous Module Definition), Module Systems
angles, conversions to and from radians, Trigonometric Functions
anonymous function expressions, Function Expressions
empty string as name of, The Name of a Function
Apache CouchDB, Historical JavaScript Milestones
apply() method, func.apply(thisValue, argArray), Function.prototype.apply()
for constructors, apply() for Constructors
manually simulating, Manually simulating an apply() for constructors
arguments object, The Special Variable arguments, All Parameters by Index: The Special Variable arguments
characteristics of, All Parameters by Index: The Special Variable arguments
converting to an array, Converting arguments to an Array
defined, Terminology: “Parameter” Versus “Argument”
deprecated features, Deprecated features of arguments
fewer properties in strict mode, The arguments objects has fewer properties
hasOwnProperty() method, All Parameters by Index: The Special Variable arguments
length, checking, Enforcing an Arity
arguments, too many or too few, Too Many or Too Few Arguments
arithmetic operators, Operators, Operators for Booleans and Numbers, Arithmetic OperatorsArithmetic Operators
arity, enforcing, Enforcing an Arity, Mandatory Parameters, Enforcing a Minimum Arity
array literals, Elegant Parts
trailing commas in, Syntactic Changes
Array() constructor, The Array Constructor
preferring literals to, Prefer Literals to Constructors
array-like objects, Pitfall: Array-Like Objects
and generic methods, Array-Like Objects and Generic Methods
patterns for working with, Patterns for working with array-like objects
Array.isArray() method, Pitfall: crossing realms (frames or windows), Array Constructor Method
Array.prototype, abbreviation in generic methods, Generic methods
Array.prototype.concat() method, Concatenating, Slicing, Joining (Nondestructive)
Array.prototype.every() method, Examination Methods
Array.prototype.filter() method, Array iteration methods, Transformation Methods
Array.prototype.forEach() method, Array iteration methods, Examination Methods, Examination Methods
iterating over array elements, Iterating over Arrays
iteration via, skipping holes, Sparse Arrays Versus Dense Arrays
thisValue for, Workaround 3: a thisValue for forEach()
Array.prototype.indexOf() method, Searching for Values (Nondestructive)
Array.prototype.join() method, Concatenating, Slicing, Joining (Nondestructive)
Array.prototype.lastIndexOf() method, Searching for Values (Nondestructive)
Array.prototype.map() method, Transformation Methods
Array.prototype.pop() method, Adding and Removing Elements (Destructive)
Array.prototype.push() method, Adding and Removing Elements (Destructive)
Array.prototype.reduce() method, Reduction Methods
Array.prototype.reduceRight() method, Reduction Methods
Array.prototype.reverse() method, Sorting and Reversing Elements (Destructive)
Array.prototype.shift() method, Adding and Removing Elements (Destructive)
Array.prototype.slice() method, Concatenating, Slicing, Joining (Nondestructive)
Array.prototype.some() method, Examination Methods
Array.prototype.sort() method, Sorting and Reversing Elements (Destructive)
Array.prototype.splice() method, Adding and Removing Elements (Destructive)
Array.prototype.unshift() method, Adding and Removing Elements (Destructive)
arrays, Objects, ArraysRegular Expressions, An Overview of the Syntax, Objects, ArraysBest Practices: Iterating over Arrays
are maps, not tuples, Arrays Are Maps, Not Tuples
array literals, Array Literals
best practice, avoiding Array() constructor, Prefer Literals to Constructors
calling array methods generically, Examples of Calling Methods Generically
concatenating, slicing, and joining, Concatenating, Slicing, Joining (Nondestructive)
concatenattion, joining an array of string fragments, Concatenation: Joining an Array of String Fragments
converting arguments to, Converting arguments to an Array
creating array of character codes, Extract Substrings
holes in, Holes in ArraysRemoving Holes from Arrays
creating, Creating Holes
operations ignoring or considering them, Which Operations Ignore Holes, and Which Consider Them?
removing, Removing Holes from Arrays
sparse versus dense arrays, Sparse Arrays Versus Dense Arrays
indices, Array Indices
deleting array elements, Deleting Array Elements
in detail, Array Indices in Detail
in operator and, The in Operator and Indices
iterating over, Iterating over Arrays
best practices, Best Practices: Iterating over Arrays
not using for-in loop, Best practice: don’t use for-in for arrays
using for loop, for
iteration methods, Iteration (Nondestructive)Reduction Methods
length, length
clearing an array, Clearing an array
clearing shared arrays, Clearing shared arrays
decreasing length of array, Decreasing the Length of an Array
increasing length of array, Manually Increasing the Length of an Array
maximum length, The Maximum Length
methods, Array Methods
multidimensional, Multidimensional Arrays
overview, Overview
properties, Arrays Can Also Have Properties
prototype methods, Array Prototype Methods
new in ECMAScript 5, New Methods
searching for values, Searching for Values (Nondestructive)
sorting and reversing elements, Sorting and Reversing Elements (Destructive)
splitting string into array of substrings, Extract Substrings
too flexible in JavaScript, Quirks and Unorthodox Features
turning into arguments with hypothetical triple dot operator (...), example, apply() for Constructors
using Array() constructor, The Array Constructor
avoiding initializing array with elements, Initializing an array with elements (avoid!)
creating empty array with given length, Creating an empty array with a given length
ASI (automatic semicolon insertion), Automatic Semicolon Insertion
example, ASI via closing brace, Example: ASI via closing brace
example, ASI via illegal token, Example: ASI via illegal token
pitfall, ASI unexpectedly not triggered, Pitfall: ASI might unexpectedly not be triggered
pitfall, unexpectedly breaking up statements, Pitfall: ASI can unexpectedly break up statements
assertions in regular expressions, Assertions, Regular Expression Cheat Sheet
lookbehind, implementing manually, Manually Implementing Lookbehind
regular expressions without assertions, Pitfall: Without an Assertion (e.g., ^, \$), a Regular Expression Is Found Anywhere
assignment, Assignment
assigning to a property, Properties: Definition Versus Assignment
compound assignment operators, Compound Assignment Operators
value to properties using dot operator, Values
assignment operator (=), An Overview of the Syntax, An Overview of the Syntax, Assignment Operators
assignment operators, compound, Compound Assignment Operators
Asynchronous Module Definition (AMD), Module Systems
attributes (property), Iteration and Detection of Properties, Property Attributes and Property Descriptors
common to all properties, Property Attributes
default values, Default values
getting and setting via property descriptors, Getting and Defining Properties via Descriptors
managing via property descriptors, Metaprogramming
sealing to prevent change in, Sealing
automatic semicolon insertion (see ASI)

B

backreferences in regular expressions, Atoms: Groups
best practices (coding style), Commonly Accepted Best Practices
binary logical operators, Binary Logical Operators, Binary Logical Operators: And (&&) and Or (||)
binary numbers, inputting and outputting, Inputting and outputting binary numbers
binary representation of numbers, The Internal Representation of Numbers
bind() method, Extracting Methods, func.bind(thisValue, arg1, ..., argN)
creating constructor via, Manually simulating an apply() for constructors
preventing shadowing of this, Workaround 2: bind()
bitwise operators, Operators for Booleans and Numbers, Integers in JavaScript, Bitwise Operators
binary, Binary Bitwise Operators
bitwise shift operators, Bitwise Shift Operators
converting numbers to integers, 32-bit Integers via Bitwise OperatorsShould I use bitwise operators to coerce to integer?
block scoping, Variables Are Function-Scoped
simulating via IIFEs, Introducing a New Scope via an IIFE
blocks
replacing statements with, Control Flow Statements and Blocks
semicolon (;) terminating, Semicolons
statements ending in, no semicolon, No Semicolon After a Statement Ending with a Block
using for bodies of loops, The Bodies of Loops and Conditionals
BOM (byte order mark), Important Unicode Concepts
Boolean() function, Functions for Converting to Boolean, Number, String, and Object, Manually Converting to Boolean
booleans, Booleans, An Overview of the Syntax, Primitive Values, BooleansEquality Operators, Ordering Operators
conversions to, and lenient equality, Pitfall: lenient equality is different from conversion to boolean
converting values to, Functions for Converting to Boolean, Number, String, and Object, Converting to Boolean, Manually Converting to Boolean
invoking Boolean() as constructor, Manually Converting to Boolean
logical NOT (!) operator, Logical Not (!)
operators for, Operators for Booleans and Numbers
truthy and falsy values, Truthy and Falsy Values
wrapper object for, Wrapper Objects for Primitives
unwrapping, Wrapping and Unwrapping Primitives
Bower (package manager), Package Managers
brace styles, Brace Styles
bracket operator ([]), Unusual Property Keys, Cheat Sheet: Working with Objects
accessing properties via, Bracket Operator ([]): Accessing Properties via Computed Keys
calling methods via, Calling methods via the bracket operator
deleting properties via, Deleting properties via the bracket operator
setting properties via, Setting properties via the bracket operator
break statements in loops, Loops, Mechanisms to Be Used with Loops
browser as operating system, Historical JavaScript Milestones
Browserify, Package Managers
browsers
consoles for entering JavaScript, JavaScript Command Lines
global object, window, Cross-Platform Considerations
javascript: URLs and, What is void used for?
legacy, tips for working with, Tips for Working with Legacy Browsers
package managers for, Package Managers
build tools, More Tools
byte order mark (BOM), Important Unicode Concepts

C

call() method (see Function.prototype.call() method)
callbacks and extracted methods, Callbacks and extracted methods
case
converting strings to lowercase, Transform
converting strings to uppercase, Transform
case clause in switch statements, Conditionals, switch
catch clause
in try-catch statement, Exception Handling, Use cases for the constructor property
in try-catch-finally statement, try-catch-finally
character class escapes in regular expressions, Atoms: General
character classes in regular expressions, Atoms: Character Classes
character escape sequences, Escaping in String Literals
character escapes in regular expressions, Atoms: General
character properties, Important Unicode Concepts
characters
accessing in strings, Character Access
and graphemes, Important Unicode Concepts
Chrome OS, Historical JavaScript Milestones
CJS (CommonJS Modules), Module Systems
clases, documenting (JSDoc)
subclassing, Subclassing
classes, documenting (JSDoc), Syntax, Documenting Classes
defining a class via constructor function, Defining a Class via a Constructor Function
defining a class via object literal, Defining a Class via an Object Literal
defining a class via object literal with @constructs method
object literal with @constructs method, Defining a Class via an Object Literal with an @constructs Method
Closure Compiler, More Tools
closures, Closures, Closures: Functions Stay Connected to Their Birth Scopes
avoiding for private data, Object Orientation
defined, Closures: Functions Stay Connected to Their Birth Scopes
handling via environments, Handling Closures via Environments
code points, Important Unicode Concepts, Code Points
matching any with regular expressions, Matching Any Code Unit and Any Code Point
code style guide, A Meta Code Style GuideConclusion
acceptable cleverness, Acceptable Cleverness
brace styles, Brace Styles
commonly accepted best practices, Commonly Accepted Best Practices
example of unrecommended cleverness, Don’t Be Clever
existing style guides, Existing Style Guides
general tips, General Tips
easy-to-read code, Code Should Be Easy to Understand
writing consistent code, Code Should Be Consistent
miscellaneous tips, Miscellaneous
preferring literals to constructors, Prefer Literals to Constructors
syntax, Controversial Rules
tight whitespace, Syntax
using variables, Variables
code units, Important Unicode Concepts
matching any with regular expressions, Matching Any Code Unit and Any Code Point
coercion, Coercion, Type Coercion
tips on, Miscellaneous
comma operator, Pitfall: ASI might unexpectedly not be triggered, The Comma Operator
command lines, JavaScript Command Lines
interaction with, Command-line interaction
commas, trailing, in object and array literals, Syntactic Changes
comments, An Overview of the Syntax, An Overview of the Syntax, Code Should Be Easy to Understand
JSDoc, JSDoc: Generating API Documentation, Syntax
CommonJS Modules (CJS), Module Systems
comparison operators, Ordering Operators
comparing strings, Comparing Strings
compound assignment operators, Compound Assignment Operators
compression of source code, The Nature of JavaScript
concatenating arrays, Concatenating, Slicing, Joining (Nondestructive)
concatenating strings, String Operators, Concatenating Strings
String.prototype.concat() method, Transform
conditional operator (? :), Conditional statement versus conditional expressions, The Conditional Operator ( ? : ), Comparing Numbers
nesting, Conditional operator
putting in parentheses, Syntax
conditional statements, An Overview of the Syntax, Conditionals, An Overview of the Syntax
bodies of, The Bodies of Loops and Conditionals
chaining if statements, Chaining if statements
if-then-else, if-then-else
console API, The Console API
checking and counting methods, Checking and Counting
debugging help, Language Mechanisms for Debugging
logging methods, Simple Logging
profiling and timing methods, Profiling and Timing
standardization across engines, How Standardized Is the Console API Across Engines?
constructor functions, Layer 3: Constructors—Factories for Instances
constructor property of instances, The constructor Property of Instances
best practices, Best practice
use cases for, Use cases for the constructor property
constructors, Constructors: Factories for Objects, The Three Roles of Functions in JavaScript, Layer 3: Constructors—Factories for InstancesAttaching global data to a method, Constructors
apply() method for, apply() for Constructors
manually simulating, Manually simulating an apply() for constructors
built-in, subclassing, Subclassing Built-insAnother Solution: Delegation
classes versus, in JSDoc, Documenting Classes
data in prototype properties, Data in Prototype Properties
in strict mode, this is undefined in nonmethod functions
inheritance between, Layer 4: Inheritance Between ConstructorsCheat Sheet: Working with Objects
avoiding hardcoding of superconstructor name, Avoiding Hardcoding the Name of the Superconstructor
cheat sheet for working with objects, Cheat Sheet: Working with Objects
ensuring that instanceof works, Ensuring That instanceof Works
example, constructor inheritance in use, Example: Constructor Inheritance in Use
example, inheritance hierarchy of built-in constructors, Example: The Inheritance Hierarchy of Built-in Constructors
generic methods, Generic Methods: Borrowing Methods from Prototypes
instance properties, Inheriting Instance Properties
making a supercall, Making a Supercall
methods of all objects, Methods of All Objects
overriding a method, Overriding a Method
pitfalls, using object as a map, Pitfalls: Using an Object as a Map
prototypal inheritance and properties, methods for, Prototypal Inheritance and Properties
prototype properties, Inheriting Prototype Properties
prototype via instance of supreconstructor, Antipattern: The Prototype Is an Instance of the Superconstructor
invoking Boolean() as, Manually Converting to Boolean
invoking with new operator, Object Operators, Layer 3: Constructors—Factories for Instances
keeping data private, Keeping Data PrivateAttaching global data to a method
literals versus, Prefer Literals to Constructors
new operator, implemented in JavaScript, The new Operator Implemented in JavaScript
protection against forgetting new operator, Protection against forgetting new: strict mode
returning arbitrary objects from, Returning arbitrary objects from a constructor
style guide for, Object Orientation
terminology, prototypes, Terminology: The Two Prototypes
wrapper objects for primitives, Wrapper Objects for Primitives
continue statements in loops, Loops
control flow statements, Control Flow Statements and Blocks
CouchDB, Historical JavaScript Milestones
Crockford privacy pattern, Private Data in the Environment of a Constructor (Crockford Privacy Pattern), An example
pros and cons, The pros and cons of the Crockford privacy pattern
cross-platform applications, Graphical User Interfaces
cross-realm instanceof, Pitfall: crossing realms (frames or windows)
current scope, Pitfall: Inadvertently Sharing an Environment

D

datatypes, JavaScript’s Type System
coercion, Coercion, Type CoercionExamples: ToPrimitive() in action
naming in JSDoc, Naming Types
static versus dynamic type checking, Static Type Checking Versus Dynamic Type Checking
static versus dynamic typing, Static Versus Dynamic
TypeError, Error Constructors
Date() function, The Date Constructor
Date.parse() method, Date Constructor Methods
Date.UTC() method, Date Constructor Methods
dates, DatesConverting a Date to a Number
constructor methods, Date Constructor Methods
constructors, The Date Constructor
converting to a number, Converting a Date to a Number
date time formats, Date Time Formats
combined, Date Time Formats
date formats (no time), Date Formats (No Time)
time formats (no date), Time Formats (No Date)
prototype methods
converting date to string, Convert a Date to a String
new in ECMAScript 5, New Methods
time unit getters and setters, Time Unit Getters and Setters
various getters and setters, Various Getters and Setters
toJSON() method, The toJSON() Method
translating date strings to date objects, JSON.parse(text, reviver?)
debugger statement, The debugger Statement, Language Mechanisms for Debugging
debugging, language mechanisms for, Language Mechanisms for Debugging
default value
for optional parameters, Optional Parameters
for property attributes, Default values
providing using || operator, Pattern: providing a default value, Default values
defining a property, Properties: Definition Versus Assignment
delegation, Another Solution: Delegation
delete operator, Single Objects, Object Operators, Deleting properties
deleting array elements, Deleting Array Elements
return value, The return value of delete
denormalized representation of numbers, Special Exponents
dense arrays, Sparse Arrays Versus Dense Arrays
destructive and nondestructive array methods, Array Prototype Methods
dictionary pattern, The dict Pattern: Objects Without Prototypes Are Better Maps, Arrays Are Maps, Not Tuples
directories for JavaScript resources, Directories for JavaScript Resources
division by zero, Error: division by zero
distinguishing between signed zeros, Distinguishing the two zeros
do-while loop, Loops, do-while
documentation
finding documentation in JavaScript, Quickly Finding Documentation
generating API documentation with JSDoc, JSDoc: Generating API DocumentationOther Useful Tags
tips for writing documentation, Code Should Be Easy to Understand
Dojo Toolkit, Historical JavaScript Milestones
DOM (Document Object Model), Historical JavaScript Milestones
jQuery for DOM manipulation, Historical JavaScript Milestones
dot operator (.), Values
double precision (floating-point numbers), The Internal Representation of Numbers
dynamic dimension (variables), Environments: Managing Variables
dynamic HTML, Historical JavaScript Milestones
dynamic semantics, Background: Static Versus Dynamic
dynamic typing, Static Typing Versus Dynamic Typing

E

ECMAScript, JavaScript Versus ECMAScript, Standardization: ECMAScript
Internationalization API, Four Language Libraries, The ECMAScript Internationalization API
types, JavaScript’s Types
versions and key features, Standardization: ECMAScript
ECMAScript 6, Standardization: ECMAScript
ECMAScript 5, What You Need to Know About This Book, New in ECMAScript 5Tips for Working with Legacy Browsers
new features, New Features
new functionality in standard library, New Functionality in the Standard Library
reserved words as property keys, ECMAScript 5: reserved words
syntactic changes, Syntactic Changes
trailing commas, ECMAScript 5: trailing commas
ECMAScript 6
safe integers, Definitions in ECMAScript 6
Eich, Brendan, How JavaScript Was Created
elegant parts of JavaScript, Elegant Parts
else clause, dangling else, Pitfall: dangling else
empty statement, The Empty Statement
empty strings, converting to numbers, Converting to Number
enumerability of a property, Iteration and Detection of Properties
best practices, Enumerability: Best Practices
effects of, The effects of enumerability
environments, The Global Object, Environments: Managing Variables
handling closures via, Handling Closures via Environments
epsilon value for double precision, Handling Rounding Errors
equality comparisons
objects versus primitive values, Primitive Values Versus Objects
equality operators, Equality Operators, Equality Operators: === Versus ==Ordering Operators
=== (strict equality) operator, An Overview of the Syntax, An Overview of the Syntax, Searching for Values (Nondestructive)
string comparisons, Comparing Strings
checking for Infinity, Checking for Infinity
distinguishing between two zeros, Best practice: pretend there’s only one zero
normal equality (==) and normal inequality (!=) operators, Equality Operators: === Versus ==, Normal (Lenient) Equality (==, !=)Ordering Operators
strict equality (===) and strict inequality (!==) operators, Equality Operators: === Versus ==, Commonly Accepted Best Practices
checking for NaN, Pitfall: checking whether a value is NaN
comparing values with different types, Strict Equality (===, !==)
NaN and strict equality, Pitfall: NaN
strict inequality (!==) comparison, Strict inequality (!==)
error objects
constructors for, Error Constructors, Error Constructors
properties of, Error Constructors
errors, producing NaN, NaN
escape sequences, Escape Sequences
escaping in string literals, Escaping in String Literals
ESLint (style checker), More Tools
eval() function
best practices, Best Practices
cleaner in strict mode, eval() Is Cleaner in Strict Mode
evaluating an object literal, Evaluating an object literal via eval()
evaluating code via, Evaluating Code Using eval()
indirect eval() evaluates in global scope, Indirect eval() evaluates in global scope
using in strict mode, Use eval() in strict mode
versus new Function(), eval() Versus new Function()
EvalError constructor, Error Constructors
evaluating JavaScript code via eval() and new Function(), Dynamically Evaluating JavaScript Code via eval() and new Function()
best practices, Best Practices
eval() versus new Function(), eval() Versus new Function()
indirect eval() evaluates in global scope, Indirect eval() evaluates in global scope
legitimate use cases, Legitimate use cases
using eval(), Evaluating Code Using eval()
using new Function(), Evaluating Code Using new Function()
every() method, iterating arrays, Array iteration methods
exception handling, Influences and Nature of the Language, Exception Handling, What Is Exception Handling?Implementing Your Own Error Constructor
defined, What Is Exception Handling?
error constructors, Error Constructors
example, any value can be thrown, Examples
in JavaScript, Exception Handling in JavaScript
stack traces, Stack Traces
throw statement, throw
try-catch-finally statement, try-catch-finally
exception objects, throw, Stack Traces
execution contexts, Environments: Managing Variables
exponential notation, Number.prototype.toExponential(fractionDigits?)
exponents, Exponent, The Internal Representation of Numbers
special, Special Exponents
expression statements, Statements Versus Expressions, Statements
expressions
conditional statement versus conditional expressions, Conditional statement versus conditional expressions
defined, Expressions
discarding results of, What is void used for?
IIFE (immediately invoked function expression), Introducing a New Scope via an IIFE
statements versus, Statements Versus Expressions
using ambiguous expressions as statements, Using ambiguous expressions as statements
extensions of objects, preventing, Preventing Extensions

F

failing fast, Miscellaneous
finally clause (try-finally), try-catch-finally, Examples
Firebug, How Standardized Is the Console API Across Engines?
Firefox OS, Historical JavaScript Milestones
flags in regular expressions, Flags, Regular Expression Cheat Sheet
problems with flag /g, Problems with the Flag /g
floating-point numbers, Numbers
representing integers as, Representing Integers as Floating-Point Numbers
for each-in loop, for each-in
for loop, Loops, for
array iteration via, Sparse Arrays Versus Dense Arrays
for-in loop, for-in, The for-in loop
caution with for-in for objects, Best practice: be careful with for-in for objects
enumerability of properties, effects of, The effects of enumerability
not using to iterate over arrays, Best practice: don’t use for-in for arrays
forEach() method (see Array.prototype.forEach() method)
freezing objects, Freezing
function declarations, Functions
defining a function, Function Declarations
hoisting, Function Declarations Are Hoisted, Hoisting
versus function expressions, Which Is Better: A Function Declaration or a Function Expression?
function expressions, Functions Inside a Method, Function Expressions
ambiguous expressions used as statements, Using ambiguous expressions as statements
defining functions with, Functions
function declarations versus, Which Is Better: A Function Declaration or a Function Expression?
IIFE (immediately invoked function expression), The IIFE Pattern: Introducing a New Scope, Immediately invoking a function expression
named, Named function expressions
names of, The Name of a Function
Function() constructor, The Function Constructor, Evaluating Code Using new Function()
function-scoped variables, Variables Are Function-Scoped
Function.prototype.apply() method, Function.prototype.apply(thisValue, argArray), Function.prototype.bind(thisValue, arg1?, ..., argN?)
destructively appending array to another array, Adding and Removing Elements (Destructive)
holes in arrays, converting to undefined elements, Function.prototype.apply()
Function.prototype.call() method, More Control over Function Calls: call(), apply(), and bind(), Function.prototype.call(thisValue, arg1?, arg2?, ...)
functions, FunctionsSimulating Named Parameters in JavaScript
calling, An Overview of the Syntax
calling while setting this, Calling Functions While Setting this: call(), apply(), and bind()
closures, Closures
constructors, Constructors: Factories for Objects
defining, An Overview of the Syntax, An Overview of the Syntax, Defining Functions
using function declarations, Function Declarations
using function expressions, Function Expressions
using Function() constructor, The Function Constructor
defining and calling, Functions
documenting (JSDoc), Documenting Functions and Methods
enabling strict mode per function, Strict Mode
function declarations versus function expressions, Which Is Better: A Function Declaration or a Function Expression?
handling missing or extra parameters, Handling Missing or Extra Parameters
arguments variable, All Parameters by Index: The Special Variable arguments
hoisting, Hoisting
implicitly returning undefined values, Occurrences of undefined
in strict mode, Functions must be declared at the top level of a scope
inside a method, Functions Inside a Method
mandatory parameters, enforcing minimum arity, Mandatory Parameters, Enforcing a Minimum Arity
more control over function calls, More Control over Function Calls: call(), apply(), and bind()
apply() method, func.apply(thisValue, argArray)
bind() method, func.bind(thisValue, arg1, ..., argN)
name of, The Name of a Function
named parameters, Named ParametersSimulating Named Parameters in JavaScript
simulating in JavaScript, Simulating Named Parameters in JavaScript
optional parameters, Optional Parameters
parameters versus arguments, Terminology: “Parameter” Versus “Argument”
passing as parameter to another function, Pitfall: Unexpected Optional Parameters
roles in JavaScript, The Three Roles of Functions in JavaScript
simulating pass-by-reference parameters, Simulating Pass-by-Reference Parameters
this as implicit parameter, this as an Implicit Parameter of Functions and Methods
too many or too few arguments, Too Many or Too Few Arguments

G

generic methods, Generic Methods: Borrowing Methods from Prototypes, Generic methods
accessing Object.prototype and Array.prototype via literals, Accessing Object.prototype and Array.prototype via Literals
array-like objects and, Array-Like Objects and Generic Methods
examples of, Examples of Calling Methods Generically
list of, A List of All Generic Methods
getters and setters (see accessors)
global data, keeping private, Keeping Global Data Private via IIFEs
attaching global data to singleton object with IIFE, Attaching private global data to a singleton object
attaching to method via IIFE, Attaching global data to a method
keeping private to all of a constructor, Keeping global data private to all of a constructor
global object, The Global Object
cross-platform considerations, Cross-Platform Considerations
use cases for window, Use case: marking global variables
global scope, Global Variables
creating things in, using window, Use case: creating things in global scope
nonconstructor functions in, Nonconstructor Functions
categorizing and parsing numbers, Categorizing and Parsing Numbers
encoding and decoding text, Encoding and Decoding Text
other variables in, Namespaces and Special Values
global variables, Identifiers and Variable Names, Global Variables, ConstructorsNamespaces and Special Values
avoiding creation of, Best Practice: Avoid Creating Global Variables
checking for existence of, Use case: checking whether a global variable exists
creating by assigning to undeclared variable, Variable Declarations Are Hoisted
eliminating by using modules, Module Systems Lead to Fewer Globals
style checkers and, Use case: style checkers
glyphs, Important Unicode Concepts
graphemes, Important Unicode Concepts
greedy matching (regular expressions), Quantifiers
groups in regular expressions, Atoms: Groups
capturing groups or returning all matching substrings, String.prototype.match: Capture Groups or Return All Matching Substrings
capturing groups while matching, RegExp.prototype.exec: Capture Groups
Grunt, More Tools
Gulp, More Tools

I

identifiers, Identifiers and Variable Names
property keys, Arbitrary Property Keys, Dot Operator (.): Accessing Properties via Fixed Keys
reserved words, Identifiers and Variable Names, Legal Identifiers
rules for naming, Legal Identifiers
IEEE 754 Standard for Floating-Point Arithmetic, Numbers
if statements, Conditional statement versus conditional expressions
chaining, Chaining if statements
dangling else clause, Pitfall: dangling else
example of, An Overview of the Syntax
not abbreviating via logical operators, Abbreviating if statements
if-then-else statements, Conditionals
if-then-else, as statement or expression, Statements Versus Expressions
IIFE (immediately invoked function expression), The IIFE Pattern: Introducing a New Scope, Immediately invoking a function expression
applications of IIFEs, IIFE Applications
attaching global data to method via, Attaching global data to a method
attaching global data to singleton object, Attaching private global data to a singleton object
avoiding inadvertent sharing via closures, IIFE use case: inadvertent sharing via closures
IIFE with parameters, IIFE Variation: An IIFE with Parameters
introducing new scope via, Introducing a New Scope via an IIFE
prefix operators, IIFE Variation: Prefix Operators
using to avoid with statement, Techniques for avoiding the with statement
implicit type conversion, Coercion
in operator, Single Objects, Object Operators
and array indices, The in Operator and Indices
checking if object has a property, Checking Whether a Property Exists, Miscellaneous
effects of inheritance, The effects of inheritance
using with arguments object, All Parameters by Index: The Special Variable arguments
using with arrays, Array Literals
indentation of code, Commonly Accepted Best Practices, Syntax
inequality operators, Equality Operators: === Versus ==, Lenient inequality (!=)
infinity, Numbers, Infinity, Namespaces and Special Values
checking for, Checking for Infinity
computing with, Computing with Infinity
error, a number’s magnitude is too large, Error: a number’s magnitude is too large
error, division by zero, Error: division by zero
negative and positive, Distinguishing the two zeros
Number.NEGATIVE_INFINITY property, Number Constructor Properties
Number.POSITIVE_INFINITY property, Number Constructor Properties
inheritance
between constructors, Layer 4: Inheritance Between ConstructorsCheat Sheet: Working with Objects
prototypal inheritance and properties, methods for, Prototypal Inheritance and Properties
prototype-based, Layer 2: The Prototype Relationship Between ObjectsLayer 3: Constructors—Factories for Instances
best practices, iterating over own properties, Best Practices: Iterating over Own Properties
iterating and detecting properties, Iteration and Detection of Properties
overriding properties, Overriding
setting and deleting affects only own properties, Setting and Deleting Affects Only Own Properties
inner and outer scope, Background: The Scope of a Variable
instance properties, Public properties
creating on demand, Creating instance properties on demand
documenting (JSDoc), Documenting Variables, Parameters, and Instance Properties
inheritance from superconstructor, Inheriting Instance Properties
of regular expressions, Instance Properties of Regular Expressions
instance prototype, Terminology: The Two Prototypes
instanceof operator, Categorizing Values Using typeof and instanceof, The instanceof Operator, Ensuring That instanceof Works
checking if object is instance of a given constructor, instanceof: Checking Whether an Object Is an Instance of a Given Constructor
crossing realms, Pitfall: crossing realms (frames or windows)
pitfall, objects not instances of Object, Pitfall: objects that are not instances of Object
integers, Numbers, Integers in JavaScript
conversions to
using parseInt(), Integers via parseInt()
converting numbers to, Converting to Integer
using bitwise operators, 32-bit Integers via Bitwise Operators
using Math.ceil(), Integers via Math.floor(), Math.ceil(), and Math.round()
using Math.floor(), Integers via Math.floor(), Math.ceil(), and Math.round()
using Math.round(), Integers via Math.floor(), Math.ceil(), and Math.round()
using ToInteger() custom function, Integers via the Custom Function ToInteger()
ranges of, Ranges of Integers
representing as floating-point numbers, Representing Integers as Floating-Point Numbers
safe integers in JavaScript, Safe Integers
safe results of arithmetic computations, Safe results of arithmetic computations
signed 32-bit integers, Signed 32-bit integers
stringified integer as array index, Array Indices in Detail
working with in JavaScript, best practice, Best practice
internal properties, Kinds of Properties
isFinite() function, Checking for Infinity, Functions for Numbers
isNaN() function, Pitfall: checking whether a value is NaN, Functions for Numbers
isNegativeZero() function, Distinguishing the two zeros
isObject() function, Converting Any Value to an Object
isomorphic JavaScript, Historical JavaScript Milestones
isSafeInteger() function, Definitions in ECMAScript 6
iteration methods, arrays, Iteration (Nondestructive)
examination methods, Examination Methods
ignorning holes in arrays, Array iteration methods
reduction methods, Reduction Methods
transformation methods, Transformation Methods

J

Jasmine (unit test frameworks), More Tools
Java, How JavaScript Was Created
JavaScript
command lines, JavaScript Command Lines
getting to know the whole ecosystem, What to Do Next
historical milestones, Historical JavaScript MilestonesHistorical JavaScript Milestones
how and why it was created, How JavaScript Was Created
nature of, The Nature of JavaScriptInfluences
elegant parts, Elegant Parts
influences from other programming languages, Influences
quirks and unorthodox features, Quirks and Unorthodox Features
reasons for choosing, Why JavaScript?
bright future of JavaScript, Does JavaScript Have a Future?
elegance of JavaScript, Is JavaScript Elegant?
free availability, Is JavaScript Freely Available?
graphical user interfaces, Graphical User Interfaces
other technologies complementing JavaScript, Other Technologies Complementing JavaScript
speed of JavaScript, Is JavaScript Fast Enough?
tools, Does JavaScript Have Good Tools?
wide use of JavaScript, Is JavaScript Widely Used?
standardization, ECMAScript, Standardization: ECMAScript
syntax, Syntax, JavaScript’s SyntaxFeatures That Are Forbidden in Strict Mode
control flow statements and blocks, Control Flow Statements and Blocks
examples of basic syntax, An Overview of the Syntax, An Overview of the Syntax
identifiers, Legal Identifiers
identifiers and variable names, Identifiers and Variable Names
invoking methods on number literals, Invoking Methods on Number Literals
semicolons, Semicolons
semicolons in code, Rules for Using SemicolonsPitfall: ASI might unexpectedly not be triggered
statements versus expressions, Statements Versus Expressions, Expressions Versus StatementsImmediately invoking a function expression
strict mode, Switching on Strict ModeFeatures That Are Forbidden in Strict Mode
values, fundamental types of, An Overview of the Syntax
JavaScript Object Notation (see JSON)
javascript: URLs, What is void used for?
join() method, converts holes in arrays to empty strings, Other array methods
jQuery, Historical JavaScript Milestones
JSDoc, generating API documentation, JSDoc: Generating API DocumentationOther Useful Tags
basic tags, Basic Tags
documenting classes, Documenting ClassesOther Useful Tags
defining a class via constructor function, Defining a Class via a Constructor Function
defining a class via object literal, Defining a Class via an Object Literal
defining a class via object literal with @constructs method, Defining a Class via an Object Literal with an @constructs Method
subclassing, Subclassing
documenting functions and methods, Documenting Functions and Methods
documenting variables, parameters, and instance properties, Documenting Variables, Parameters, and Instance Properties
inline type information, Inline Type Information (“Inline Doc Comments”)
naming types, Naming Types
other useful tags, Other Useful Tags
syntax, Syntax
JSHint (style checker), More Tools
JSLint (style checker), More Tools
JSON (JavaScript Object Notation), Other Technologies Complementing JavaScript, Historical JavaScript Milestones, JSONJSON.parse()
data format, Data Format
grammar, Grammar
history, History
support in ECMAScript 5, JSON
toJSON() method, The toJSON() Method
transforming data via node visitors, Transforming Data via Node Visitors
JSON.parse(), JSON.parse(text, reviver?)
iteration over JavaScript data, JSON.parse()
JSON.stringify(), Manually Converting to String, JSON.stringify(value, replacer?, space?)
iteration over JavaScript data, JSON.stringify()
properties ignored by, Data Ignored by JSON.stringify()

L

length property
arguments object, All Parameters by Index: The Special Variable arguments, Mandatory Parameters, Enforcing a Minimum Arity
arrays, Array Literals, Overview, lengthThe Maximum Length
strings, Strings, String Instance Property length
lexical (static) dimension (variables), Environments: Managing Variables
lexical scoping, Background: The Scope of a Variable
lexical semantics, Background: Static Versus Dynamic
libraries, Other Technologies Complementing JavaScript, Four Language LibrariesDirectories for JavaScript Resources
directories for JavaScript resources, Directories for JavaScript Resources
ECMAScript Internationalization API, The ECMAScript Internationalization API
handling Unicode in JavaScript, Libraries
shims versus polyfills, Shims Versus Polyfills
line continuations for strings, Escaping in String Literals
line terminators, JavaScript Regular Expressions and Unicode
lint tools, More Tools
literals, preferring over constructors, Prefer Literals to Constructors
Lo-Dash library, Four Language Libraries
logging methods, console API, Simple Logging
logical operators, Operators for Booleans and Numbers, Binary Logical Operators: And (&&) and Or (||)
abbreviating if statements, Abbreviating if statements
logical NOT (!), Logical Not (!)
lookbehind, manually implementing, Manually Implementing Lookbehind
loops, Loops, The Bodies of Loops and Conditionalsfor each-in
bodies of, The Bodies of Loops and Conditionals
do-while loop, do-while
for each-in loop, for each-in
for loop, for
for-in loop, for-in
mechanisms to be used with, Mechanisms to Be Used with Loops
exiting loops, Mechanisms to Be Used with Loops
while loop, while, while
low-surrogate code unit, Unicode Encodings

M

machine epsilon, Handling Rounding Errors
map() method
creating new array from existing array, Iterating over Arrays
parseInt() function passed as argument to, Pitfall: Unexpected Optional Parameters
maps
arrays as, Arrays Are Maps, Not Tuples
using objects as, pitfalls in, Pitfalls: Using an Object as a Map
marked property keys, Private Data in Properties with Marked Keys
Math object, MathOther Functions
arithmetic functions, Math
numerical functions, Numerical Functions
other functions, Other Functions
properties, Math Properties
trigonometric functions, Trigonometric Functions
Math.abs() function, Numerical Functions
Math.acos() function, Trigonometric Functions
Math.asin() function, Trigonometric Functions
Math.atan() function, Trigonometric Functions
Math.atan2() function, Distinguishing the two zeros, Trigonometric Functions
Math.ceil() function, Integers via Math.floor(), Math.ceil(), and Math.round(), Numerical Functions
Math.cos() function, Trigonometric Functions
Math.exp() function, Numerical Functions
Math.floor() function, Integers via Math.floor(), Math.ceil(), and Math.round(), Numerical Functions
Math.log() function, Numerical Functions
Math.max() function, Other Functions
Math.min() function, Other Functions
Math.pow() function, Distinguishing the two zeros, Numerical Functions
Math.random() function, Other Functions
Math.round() function, Integers via Math.floor(), Math.ceil(), and Math.round(), Numerical Functions
Math.sin() function, Trigonometric Functions
Math.sqrt() function, Numerical Functions
MDN (Mozilla Developer Network), Quickly Finding Documentation
media type for JavaScript files, Source Code Externally
metadata tags in JSDoc, Basic Tags
methods, Single Objects, The Three Roles of Functions in JavaScript, Kinds of Properties
attaching global data via IIFE, Attaching global data to a method
calling, An Overview of the Syntax
calling using bracket operator, Calling methods via the bracket operator
calling using dot operator, Calling methods
common to all objects, Methods of All Objects, Cheat Sheet: Working with Objects
documenting (JSDoc), Documenting Functions and Methods
extracting, Extracting Methods
callbacks and, Callbacks and extracted methods
losing this, Pitfall: Losing this When Extracting a Method
functions inside, Functions Inside a Method
generic (see generic methods)
invoking on number literals, Invoking Methods on Number Literals, Invoking Methods on Literals
invoking with dot operator, Values
new, in ECMAScript 5, New Methods
overriding, Overriding a Method
privileged, Private Data in the Environment of a Constructor (Crockford Privacy Pattern), Privileged methods
supercalling, Making a Supercall
this as implicit parameter, this as an Implicit Parameter of Functions and Methods
minification, The Nature of JavaScript
tools for, Source Code Externally, More Tools
mocha (unit test frameworks), More Tools
module systems, Module Systems
keeping global data private, Keeping global data private to all of a constructor
quick and dirty modules, Quick and Dirty Modules
Mozilla Developer Network (MDN), Quickly Finding Documentation
multidimensional arrays, Multidimensional Arrays

N

named accessor properties, Kinds of Properties
named data properties, Kinds of Properties
named function expressions, Named function expressions, The Name of a Function
named parameters, Named ParametersSimulating Named Parameters in JavaScript
as descriptions, Named Parameters as Descriptions
optional, Optional Named Parameters
optional parameters as, Optional Parameters
simulating in JavaScript, Simulating Named Parameters in JavaScript
NaN (not a number), Numbers, NaN, Namespaces and Special Values
comparing via strict equality, Pitfall: NaN
isNaN() function, Functions for Numbers
pitfall, checking whether a value is NaN, Pitfall: checking whether a value is NaN
Netscape, How JavaScript Was Created
new operator, Constructors: Factories for Objects, The Three Roles of Functions in JavaScript, Layer 3: Constructors—Factories for Instances, The new Operator Implemented in JavaScript
protection against forgetting when using a constructor, Protection against forgetting new: strict mode
Node Packaged Modules (NPM), Package Managers
node visitors
transforming data via, Transforming Data via Node Visitors
node visitors (JSON), JSON.parse(text, reviver?)
Node.js, JavaScript Command Lines, Other Technologies Complementing JavaScript
global object and, Cross-Platform Considerations
implementing JavaScript on the server, Historical JavaScript Milestones
nondestructive array methods, Array Prototype Methods
nonmethod functions, The Three Roles of Functions in JavaScript
normal (or lenient) equality, Equality Operators
normalization (Unicode), Important Unicode Concepts, Unicode Normalization
normalized representation of numbers, Special Exponents
null, undefined and null, Primitive Values, undefined and null
checking for, Checking for null, Use case: checking for undefined or null
checking for either undefined or null, Checking for either undefined or null
history of, The History of undefined and null
occurrences of, Occurrences of null
Number() function, Functions for Converting to Boolean, Number, String, and Object, The Function Number
manually converting to number, Manually Converting to Number
Number.MAX_VALUE property, Number Constructor Properties
Number.MIN_VALUE property, Number Constructor Properties
Number.NEGATIVE_INFINITY property, Number Constructor Properties
Number.POSITIVE_INFINITY property, Number Constructor Properties
Number.prototype methods, Number Prototype Methods
Number.prototype.toExponential() method, Number.prototype.toExponential(fractionDigits?)
Number.prototype.toFixed() method, Number.prototype.toFixed(fractionDigits?)
Number.prototype.toPrecision() method, Number.prototype.toPrecision(precision?)
Number.prototype.toString() method, Inputting and outputting binary numbers, Number.prototype.toString(radix?)
numbers in JavaScript, Numbers, An Overview of the Syntax, Primitive Values, NumbersSources for This Chapter
arithmetic operators for, Operators for Booleans and Numbers, Arithmetic OperatorsArithmetic Operators
bitwise operators, Bitwise Operators
categorizing and parsing, functions for, Categorizing and Parsing Numbers
comparing in arrays, Comparing Numbers
converting a date to a number, Converting a Date to a Number
converting objects to, Pitfall: all objects are truthy
converting to integers, Converting a number to an integer
converting values to number, Functions for Converting to Boolean, Number, String, and Object, Converting to Number
manual conversions, Manually Converting to Number
functions for, Functions for Numbers
handling rounding errors, Handling Rounding Errors
integers, Integers in JavaScript
internal representation of, The Internal Representation of Numbers
special exponents, Special Exponents
invoking methods on number literals, Invoking Methods on Number Literals
number literals, Number Literals
exponent, Exponent
invoking methods on, Invoking Methods on Literals
ordering operators, Ordering Operators
prototype methods, Number Prototype Methods
special number values, Special Number Values
Infinity, Infinity
NaN, NaN
two zeros, Two ZerosDistinguishing the two zeros
wrapper objects for, Wrapper Objects for Primitives

O

object literals, Objects, Elegant Parts, Object Literals, Cheat Sheet: Working with Objects
accessing Object.prototype via an empty object literal, Accessing Object.prototype and Array.prototype via Literals
ambiguous expression or statement, Using ambiguous expressions as statements
better choice than Object() constructor, Converting Any Value to an Object
defining a class via (JSDoc), Defining a Class via an Object Literal
defining accessors via, Defining Accessors via an Object Literal
evaluating with eval(), Evaluating an object literal via eval()
trailing commas in, Syntactic Changes
Object() function, Functions for Converting to Boolean, Number, String, and Object
converting values to objects, Converting Any Value to an Object
invoking as constructor, Converting Any Value to an Object
Object, global variable as namespace for metaprogramming functionality, Namespaces and Special Values
object-oriented programming (OOP) in JavaScript, Objects and InheritanceCheat Sheet: Working with Objects
layer 1, single objects, Objects and InheritanceLayer 2: The Prototype Relationship Between Objects
layer 2, prototype relationship between objects, Layer 2: The Prototype Relationship Between ObjectsLayer 3: Constructors—Factories for Instances
layer 3, constructors, factories for instances, Layer 3: Constructors—Factories for InstancesAttaching global data to a method
layer 4, inheritance between constructors, Layer 4: Inheritance Between ConstructorsCheat Sheet: Working with Objects
style guide, Object Orientation
Object.create() method, Creating a new object with a given prototype
Object.defineProperties() method, Examples, Getting and Defining Properties via Descriptors
Object.defineProperty() method, Getting and Defining Properties via Descriptors
Object.freeze() method, Freezing
Object.getOwnPropertyDescriptor() method, Getting and Defining Properties via Descriptors
Object.getOwnPropertyNames() method, Listing Own Property Keys
Object.getPrototypeOf() method, Reading the prototype of an object, Terminology: The Two Prototypes
Object.keys() method, Listing Own Property Keys, The effects of enumerability
Object.preventExtensions() method, Preventing Extensions
Object.prototype, abbreviation for generic methods, Generic methods
Object.prototype.hasOwnProperty() method, Finding the object where a property is defined, Checking Whether a Property Exists, Prototypal Inheritance and Properties
checking existence of properties, Miscellaneous
Object.prototype.isPrototypeOf() method, Checking whether one object a prototype of another one, Methods of All Objects, Prototypal Inheritance and Properties
Object.prototype.propertyIsEnumerable() method, Prototypal Inheritance and Properties
Object.prototype.toLocaleString() method, Object.prototype.toLocaleString()
Object.prototype.toString() method, Conversion to Primitive
Object.prototype.valueOf() method, Conversion to Primitive
Object.seal() method, Sealing
objects, Objects, Objects and ConstructorsArrays, An Overview of the Syntax, Objects, Objects and InheritanceCheat Sheet: Working with Objects
accessors, Accessors (Getters and Setters)
and inheritance, Accessors and Inheritance
defining accessors via object literal, Defining Accessors via an Object Literal
defining accessors via property descriptors, Defining Accessors via Property Descriptors
arrays, Objects, Objects
best practices, iterating over own properties, Best Practices: Iterating over Own Properties
characteristics of, Objects, Objects
cheat sheet for working with, Cheat Sheet: Working with Objects
comparing in array sorting, Comparing Objects
comparing via lenient equality (==), Pitfall: lenient equality and objects
comparing via strict equality (===), Strict Equality (===, !==)
constructors, Constructors: Factories for Objects
conversion to booleans
all objects are truthy, Pitfall: all objects are truthy
converting to numbers, Converting to Number
converting to strings, Functions for Converting to Boolean, Number, String, and Object
converting values to, Converting Any Value to an Object
copying using property descriptors, Copying an Object
extracting methods from, Extracting Methods
instanceof operator, instanceof: Checking Whether an Object Is an Instance of a Given Constructor
iterating and detecting properties, Iteration and Detection of Properties
checking whether property exists, Checking Whether a Property Exists
effects of enumerability, The effects of enumerability
effects of inheritance, The effects of inheritance
examples, Examples
listing all enumerable property keys, Listing All Property Keys
listing own property keys, Listing Own Property Keys
number of own properties of object, Computing the number of own properties of an object
iterating over all properties with for-in loop, for-in
caution with, Best practice: be careful with for-in for objects
methods, The Three Roles of Functions in JavaScript
methods common to all, Methods of All Objects, Cheat Sheet: Working with Objects
more than maps, Object Literals
objects thar are not instances of Object, Pitfall: objects that are not instances of Object
operators and, Operators and Objects
operators for, Object Operators
primitive values versus, Primitive Values Versus Objects, Primitive Values Versus Objects
property attributes and property descriptors, Property Attributes and Property Descriptors
protecting, Protecting Objects, Cheat Sheet: Working with Objects, Metaprogramming
pitfall, protection is shallow, Pitfall: Protection Is Shallow
sharing data via prototype, Sharing Data Between Objects via a Prototype
single, Single Objects, Layer 1: Single Objects
using as maps
advantages of prototypeless objects, Prototype-less objects
best practices, Best Practices
dict pattern, objects without prototypes, The dict Pattern: Objects Without Prototypes Are Better Maps
pitfalls in, Pitfalls: Using an Object as a Map
versus primitive values, Primitive Values Versus Objects
wrapper objects for primitives, Wrapper Objects for PrimitivesType Coercion
ones’ complement, Bitwise Not Operator
operators, OperatorsObject Operators
+ (plus) operator, The Plus Operator (+)
, (comma) operator, The Comma Operator
? : (conditional) operator, The Conditional Operator ( ? : )
and objects, Operators and Objects
arithmetic operators, Operators
assignment operator, Assignment Operators
binary logical operators, Binary Logical Operators, Operators for Booleans and Numbers, Binary Logical Operators: And (&&) and Or (||)
coercion of operands to type needed, Type Coercion
compound assignment operators, Compound Assignment Operators
equality operators, Equality Operators, Equality Operators: === Versus ==Ordering Operators
for booleans and numbers, Operators for Booleans and Numbers
for objects, Object Operators
for strings, String Operators
instanceof, Categorizing Values Using typeof and instanceof, Categorizing Values via typeof and instanceofObject Operators
ordering operators, Ordering Operators
precedence, Object Orientation
producing booleans, Booleans
typeof, Categorizing Values Using typeof and instanceof, Categorizing Values via typeof and instanceofObject Operators
void operator, The void Operator
optional parameters, Optional Parameters
named, Optional Named Parameters
unexpected, Pitfall: Unexpected Optional Parameters
ordering operators, Ordering Operators
evaluating a comparison, The Algorithm
outer scope, Background: The Scope of a Variable
overriding
methods, Overriding a Method

P

package managers, Module Systems and Package Managers, Package Managers
parameters
defined, Terminology: “Parameter” Versus “Argument”
documenting (JSDoc), Documenting Functions and Methods, Documenting Variables, Parameters, and Instance Properties
enforcing specific number of, Enforcing an Arity, Mandatory Parameters, Enforcing a Minimum Arity
IIFE with, IIFE Variation: An IIFE with Parameters
missing or extra, handling, Handling Missing or Extra Parameters
missing or undefined, Occurrences of undefined
named, Named ParametersSimulating Named Parameters in JavaScript
optional, Optional Parameters, Optional Parameters
pass by reference, simulating, Simulating Pass-by-Reference Parameters
positional, Named Parameters
providing a default value for, Example 1: a default for a parameter
stricter rules for, in strict mode, Stricter rules for function parameters
this as implicit parameter of functions and methods, this as an Implicit Parameter of Functions and Methods
parseFloat() function, parseFloat(), Functions for Numbers
parseInt() function, Integers via parseInt(), Number.prototype.toString(radix?), Functions for Numbers
incorrect conversion of number to integer, The radix
parsing string in binary notation, Inputting and outputting binary numbers
passing as argument to map(), Pitfall: Unexpected Optional Parameters
partial function application, func.bind(thisValue, arg1, ..., argN), Function.prototype.bind(thisValue, arg1?, ..., argN?)
pattern characters in regular expressions, Atoms: General
PhoneGap, Historical JavaScript Milestones
plain objects, Object Literals
planes (Unicode), Code Points
polyfills, Shims Versus Polyfills
polymorphic prototype properties, Polymorphic Prototype Properties
positional parameters, Named Parameters
combining with named parameters, Simulating Named Parameters in JavaScript
prefix operators, IIFE Variation: Prefix Operators
primitive values
characteristics of, Primitive Values, Primitive Values
comparing wrapper instances with, using lenient equality (==), Use case: comparing wrapper instances with primitives
conversion to, Conversion to Primitive
converting values to, using ToPrimitive() function, Algorithm: ToPrimitive()—Converting a Value to a Primitive
functions for conversion of other values to, Functions for Converting to Boolean, Number, String, and Object
operators working with, Operators and Objects
types of, Primitive Values
versus objects, Primitive Values Versus Objects, Primitive Values Versus Objects
wrapper objects for, Wrapper Objects for PrimitivesType Coercion
difference between wrapper objects and primitives, Wrapper Objects Are Different from Primitives
wrapping and unwrapping, Wrapping and Unwrapping Primitives
private data for objects, Keeping Data PrivateAttaching global data to a method
Crockford privacy pattern, An example
in constructor environment, Private Data in the Environment of a Constructor (Crockford Privacy Pattern)
in properties with marked keys, Private Data in Properties with Marked Keys
in properties with reified keys, Private Data in Properties with Reified Keys
keeping global data private via IIFEs, Keeping Global Data Private via IIFEs
private values (Crockford privacy pattern), Private Data in the Environment of a Constructor (Crockford Privacy Pattern), Private values
privileged methods (Crockford privacy pattern), Private Data in the Environment of a Constructor (Crockford Privacy Pattern), Privileged methods
program scope, Global Variables
programming languages influencing JavaScript, Influences
properties
accessing via dot operator, Dot Operator (.): Accessing Properties via Fixed Keys
arbitrary property keys, Arbitrary Property Keys
array, Array Literals, Arrays Can Also Have Properties
checking existence of, Miscellaneous
definition versus assignment, Properties: Definition Versus Assignment
deleting, Deleting properties
enumerability, Iteration and Detection of Properties
getting via bracket operator, Getting properties via the bracket operator
illegal manipulation of, in strict mode, Setting and Deleting Immutable Properties Fails with an Exception in Strict Mode
iteration and detection of, Cheat Sheet: Working with Objects
kinds of, Kinds of Properties
legal property keys, Unusual Property Keys
listing, new functionality in ECMAScript 5, Metaprogramming
nonexistent or undefined, Occurrences of undefined
object used as map, Pitfalls: Using an Object as a Map
checking if property exists, Checking whether a property exists
collecting property keys, Collecting property keys
getting a property value, Getting a property value
of objects, Objects, Single Objects, Objects
mutability of, Objects
of primitive values, Primitive Values, Primitive Values
of values, Values, Values
properties as entries in objects, Layer 1: Single Objects
reserved words as property keys, Syntactic Changes
setting, Setting properties
with marked keys, private data in, Private Data in Properties with Marked Keys
with reified keys, private data in, Private Data in Properties with Reified Keys
property attributes (see attributes)
property descriptors, Property Attributes and Property Descriptors, Property Descriptors
defining accessors via, Defining Accessors via Property Descriptors
functions for, Getting and Defining Properties via Descriptors
getting and defining properties via, Cheat Sheet: Working with Objects
managing property attributes via, Metaprogramming
using to copy an object, Copying an Object
proto property, The Special Property __proto__, Pitfall 3: The Special Property __proto__
prototype properties, Public properties
data in, Data in Prototype Properties
inheriting, Inheriting Prototype Properties
nonpolymorphic, avoiding, Avoid Nonpolymorphic Prototype Properties
polymorphic, Polymorphic Prototype Properties
with initial values for instance properties, avoiding, Avoid Prototype Properties with Initial Values for Instance Properties
prototype property, Constructors: Factories for Objects
versus the prototype relationship, Terminology: The Two Prototypes
prototype relationship between objects, Layer 2: The Prototype Relationship Between ObjectsLayer 3: Constructors—Factories for Instances
changing properties anywhere in prototype chain, Changing properties anywhere in the prototype chain
checking if object is prototype of another, Checking whether one object a prototype of another one
creating new object with given prototype, Creating a new object with a given prototype
deleting inherited property, Deleting an inherited property
finding object where a property is defined, Finding the object where a property is defined
getting and setting the prototype, Getting and Setting the Prototype
inheritance of properties, Inheritance
overriding properties, Overriding
setting a property, Setting a property
setting and deleting affects only own properties, Setting and Deleting Affects Only Own Properties
special property proto, The Special Property __proto__
prototypes versus prototype property, Terminology: The Two Prototypes
public properties (Crockford privacy pattern), Private Data in the Environment of a Constructor (Crockford Privacy Pattern)

Q

quantifiers in regular expressions, Quantifiers, Regular Expression Cheat Sheet
quotation marks for string literals, Strings, String Literals
best practice, Commonly Accepted Best Practices
quoteText() function, Quoting Text

R

random numbers, Other Functions
RangeError constructor, Error Constructors
ranges of integers, Ranges of Integers
realms, Pitfall: crossing realms (frames or windows)
receiver of a method call, this as an Implicit Parameter of Functions and Methods
receiver of method invocation, Object Literals
reduction methods, Reduction Methods
ReferenceError constructor, Error Constructors
RegExp() constructor, Literal Versus Constructor
RegExp.prototype.exec() method, RegExp.prototype.exec: Capture Groups
RegExp.prototype.text() method, RegExp.prototype.test: Is There a Match?
regular expressions, Objects, Regular Expressions, Objects, Regular ExpressionsRegular Expression Cheat Sheet
capturing groups or returning all matching substrings, String.prototype.match: Capture Groups or Return All Matching Substrings
capturing groups while matching against string, RegExp.prototype.exec: Capture Groups
checking if regular expression matches a string, RegExp.prototype.test: Is There a Match?
creating, Creating a Regular Expression
examples, Examples of Creating Regular Expressions
flags, Flags
using a literals or the constructor, Literal Versus Constructor
exec() method, matching and capturing groups, Method exec(): Match and Capture Groups
finding text in strings, Search and Compare
index where match is found, String.prototype.search: At What Index Is There a Match?
instance properties, Instance Properties of Regular Expressions
JavaScript, Unicode and, JavaScript Regular Expressions and Unicode
libraries helping with, Libraries
matching any code unit and any code point, Matching Any Code Unit and Any Code Point
manually implementing lookbehind, Manually Implementing Lookbehind
matching everything or nothing, Matching Everything or Nothing
problems with the flag /g, Problems with the Flag /g
quick reference, Regular Expression Cheat Sheet
quoting text, Quoting Text
replace() method, search and replace with, Method replace(): Search and Replace
search and replace, String.prototype.replace: Search and Replace
replacement is a function, Replacement Is a Function
replacement is a string, Replacement Is a String
syntax, Regular Expression Syntax
asseertions, Assertions
character classes, Atoms: Character Classes
disjunction, Disjunction
general atoms, Atoms: General
groups, Atoms: Groups
quantifiers, Quantifiers
test() method, Regular Expressions
testing, matching, and replacing text in strings, Test, Match, and Replace with Regular Expressions
Unicode and, Unicode and Regular Expressions
without assertions, finding a pattern everywhere, Pitfall: Without an Assertion (e.g., ^, \$), a Regular Expression Is Found Anywhere
reified property keys, Private Data in Properties with Reified Keys
reluctant matching (regular expressions), Quantifiers
RequireJS, Quick and Dirty Modules
reserved words, Identifiers and Variable Names
as property keys, Unusual Property Keys, Syntactic Changes
identifiers, Legal Identifiers
return statements, switch
in function declarations, Functions
rounding numbers
handling rounding errors, Handling Rounding Errors
Math.ceil() function, Numerical Functions
Math.floor() function, Numerical Functions
Math.round() function, Integers via Math.floor(), Math.ceil(), and Math.round(), Numerical Functions

S

scaffolding tools, More Tools
scoping
closures, functions staying connected to birth scopes, Closures: Functions Stay Connected to Their Birth Scopes
current scope, Pitfall: Inadvertently Sharing an Environment
functions in strict mode, Functions must be declared at the top level of a scope
global object, The Global Object
global variables, Global Variables
introducing new scope via IIFE, Introducing a New Scope via an IIFE
managing variables in environments, Environments: Managing Variables
scope and chain of environments, Environments: Managing Variables
scope of a variable, Background: The Scope of a Variable
sealing of objects, Sealing
searching and comparing strings, Search and Compare
setters (see accessors)
shadowing variables, Background: The Scope of a Variable
shift operators
bitwise shift operators, Bitwise Shift Operators
converting numbers to integers, Shift operators
shims, Shims Versus Polyfills
short-circuiting (binary logical operators), Binary Logical Operators, Binary Logical Operators: And (&&) and Or (||)
sign (international representation of numbers), The Internal Representation of Numbers
signed 32-bit integers, Signed 32-bit integers
signed zeros, Two ZerosDistinguishing the two zeros
source code, JavaScript deployment as, The Nature of JavaScript
sparse arrays, Sparse Arrays Versus Dense Arrays
special characters in regular expressions, Atoms: General, Quoting Text
stack traces, Stack Traces
standard library, Other Functionality of the Standard Library
new functionality in ECMAScript 5, New Functionality in the Standard Library
statements, Declaring and Assigning VariablesThe debugger Statement
bodies of loops and conditionals, The Bodies of Loops and Conditionals
conditional, Conditionals
chaining if statements, Chaining if statements
if-then-else, if-then-else
conditional statement versus conditional expressions, Conditional statement versus conditional expressions
debugger, The debugger Statement
declaring and assigning variables, Declaring and Assigning Variables
defined, Statements
empty, The Empty Statement
expressions versus, Statements Versus Expressions
loops, Loops, The Bodies of Loops and Conditionals
mechanisms to be used with, Mechanisms to Be Used with Loops
switch, switchswitch
throw, throw
try-catch-finally, try-catch-finally
using ambiguous expressions as, Using ambiguous expressions as statements
with, The with StatementThe Rationale for the Deprecation
static dimension (variables), Environments: Managing Variables
static semantics, Background: Static Versus Dynamic
static typing, Static Typing Versus Dynamic Typing
strict equality, Equality Operators
strict mode, Strict Mode, Switching on Strict ModeFeatures That Are Forbidden in Strict Mode, Commonly Accepted Best Practices
arguments variable in, Deprecated features of arguments
eval() function in, eval() Is Cleaner in Strict Mode, Use eval() in strict mode
explicit variable declaration, requirement in, Variables Must Be Declared in Strict Mode
functions in, Functions must be declared at the top level of a scope
illegal manipulations of properties, Setting and Deleting Immutable Properties Fails with an Exception in Strict Mode
in ECMAScript 5, New Features
inability to delete unqualified identifiers in, Unqualified Identifiers Can’t Be Deleted in Strict Mode
protection against forgetting to use new with constructors, Protection against forgetting new: strict mode
switching on, Switching on Strict Mode
warnings about use of, Strict Mode: Recommended, with Caveats
string literals
escaping in, Escaping in String Literals
multiline, in ECMAScript 5, Syntactic Changes
quoting of, String Literals
String() function, The Function String
String.fromCharCode() method, String Constructor Method
String.prototype.charAt() method, Extract Substrings
String.prototype.charCodeAt() method, String Constructor Method, Extract Substrings
String.prototype.concat() method, Transform
String.prototype.lastIndexOf() method, Search and Compare
String.prototype.localeCompare() method, Comparing Strings, Search and Compare, Comparing Strings
String.prototype.match() method, Test, Match, and Replace with Regular Expressions, String.prototype.match: Capture Groups or Return All Matching Substrings
String.prototype.replace() method, Test, Match, and Replace with Regular Expressions, String.prototype.replace: Search and Replace
String.prototype.search() method, String.prototype.search: At What Index Is There a Match?
String.prototype.slice() method, Extract Substrings
String.prototype.split() method, Extract Substrings
String.prototype.substring() method, Extract Substrings
String.prototype.toLocaleLowerCase() method, Transform
String.prototype.toLocaleUpperCase() method, Transform
String.prototype.toLowerCase() method, Transform
String.prototype.toUpperCase() method, Transform
String.prototype.trim() method, Transform
strings, Strings, An Overview of the Syntax, Primitive Values, StringsTest, Match, and Replace with Regular Expressions
character access, Character Access
comparing, Comparing Strings
comparing when sorting arrays, Comparing Strings
comparisons of, The Algorithm
concatenating, Concatenating Strings
joining an array of string fragments, Concatenation: Joining an Array of String Fragments
conversion to booleans, lenient equality and, Pitfall: lenient equality is different from conversion to boolean
converting dates to, Convert a Date to a String
converting objects to, Pitfall: all objects are truthy
converting to integers, Integers via parseInt()
converting to numbers, Converting to Number
using parseFloat(), parseFloat()
converting values to, Functions for Converting to Boolean, Number, String, and Object, Converting to String
pitfall, conversion is not invertible, Pitfall: conversion is not invertible
JavaScript strings and Unicode, JavaScript Strings and Unicode
counting characters, Counting Characters
escape sequences, Escape Sequences
referring to astral plane characters via escapes, Refering to Astral Plane Characters via Escapes
Unicode normalization, Unicode Normalization
JSON, Data Format
length property, String Instance Property length
lenient equality and, Pitfall: lenient equality and strings
methods, String Methods
numbers in, lenient equality comparisons and, Use case: working with numbers in strings
operators for, String Operators
prototype methods, String Prototype Methods
extracting substrings, Extract Substrings
matching and replacing text in strings, Test, Match, and Replace with Regular Expressions
searching and comparing strings, Search and Compare
transforming existing strings, Transform
string literals, String Literals
escaping in, Escaping in String Literals
String() function, The Function String
toString() method, Conversion to Primitive
wrapper object for, Wrapper Objects for Primitives
style guides, Existing Style Guides
subclassing built-ins, Subclassing Built-insAnother Solution: Delegation
delegation as alternative to, Another Solution: Delegation
obstacle 1, instances with internal properties, Obstacle 1: Instances with Internal Properties
obstacle 2, constructor can’t be called as function, Obstacle 2: A Constructor That Can’t Be Called as a Function
subclassing in JSDoc, Subclassing
supercalls, Making a Supercall
superconstructor, referring to, Use cases for the constructor property
surrogate pair, Unicode Encodings, Counting Characters
switch statement, Conditionals, switchswitch
SyntaxError constructor, Error Constructors

T

tags (JSDoc), Syntax, Basic Tags
this variable, Single Objects
and functions in strict mode, this is undefined in nonmethod functions
and functions nested in methods, Functions Inside a Method
avoiding as implicit parameter, Miscellaneous
calling functions while setting this, Calling Functions While Setting this: call(), apply(), and bind()
extracted methods and, Extracting Methods
implicit parameter of functions and methods, this as an Implicit Parameter of Functions and Methods
losing when extracting a method, Pitfall: Losing this When Extracting a Method
pointing to global object, The Global Object
using in methods to refer to current object, Object Literals
throw statements, switch, throw
time, The Date Constructor
human-readable, Convert a Date to a String
time formats, Time Formats (No Date)
time unit getters and setters, Time Unit Getters and Setters
UTC (Coordinated Universal Time), Dates, Date Constructor Methods
ToInt32() function, Bitwise Or (|)
ToInteger() custom function, Integers via the Custom Function ToInteger()
toJSON() method, The toJSON() Method
built-in toJSON() methods, The toJSON() Method
toLocaleString() method, Object.prototype.toLocaleString()
tools, More Tools
ToPrimitive() function, Algorithm: ToPrimitive()—Converting a Value to a Primitive
examples of use, Examples: ToPrimitive() in action
toString() method, Manually Converting to String, Conversion to Primitive
two zeros and, Best practice: pretend there’s only one zero
ToUint32() function, Shift operators, Array Indices in Detail
transformation methods, arrays, Transformation Methods
truthy and falsy values, Truthy and Falsy Values
pitfall, all objects are truthy, Pitfall: all objects are truthy
try-catch-finally statements, Exception Handling, try-catch-finally
twos’ complement, Binary complements
type annotations (JSDoc), Syntax
type coercion, Coercion, Type CoercionExamples: ToPrimitive() in action
functions for converting to primitive, Functions for Converting to Boolean, Number, String, and Object
TypeError constructor, Error Constructors
typeof operator, Categorizing Values Using typeof and instanceof, typeof: Categorizing Primitives
bug, typeof null returning object, Categorizing Values Using typeof and instanceof, Pitfall: typeof null
checking for undefined values, Checking for undefined
checking if variable exists, Checking whether a variable exists, Use case: checking whether a global variable exists
history of typeof null, The history of typeof null
using with isNaN(), Pitfall: checking whether a value is NaN
types (see datatypes)

U

UCS-2, Unicode Encodings
UglifyJS (minification tool), Source Code Externally, More Tools
undefined, undefined and null, Primitive Values, undefined and null
changing, Changing undefined
checking for, Use case: checking for undefined or null
checking for either undefined or null, Checking for either undefined or null
history of, The History of undefined and null
missing function parameters, Too Many or Too Few Arguments
occurrences of, Occurrences of undefined
setting object property to, Deleting properties
void 0 as synonym for, What is void used for?
undefined values, Namespaces and Special Values
checking for, Checking for undefined
missing function parameters, Mandatory Parameters, Enforcing a Minimum Arity
unitialized variables, Declaring a Variable
Underscore.js library, Four Language Libraries
Unicode, Unicode and JavaScriptRecommended Reading and Chapter Sources
and regular expressions, Unicode and Regular Expressions
BOM (byte order mark), Important Unicode Concepts
character properties, Important Unicode Concepts
characters and graphemes, Important Unicode Concepts
code points, Important Unicode Concepts, Code Points
code units, Important Unicode Concepts
encodings, Unicode Encodings
escape sequences, Escaping in String Literals
glyphs, Important Unicode Concepts
history of, Unicode History
important concepts, Important Unicode Concepts
JavaScript regular expressions and, JavaScript Regular Expressions and Unicode
libraries, Libraries
matching any code unit and any code point, Matching Any Code Unit and Any Code Point
JavaScript source code and, JavaScript Source Code and Unicode
source code externally, Source Code Externally
source code internally, Source Code Internally
JavaScript strings and, JavaScript Strings and Unicode
counting characters, Counting Characters
escape sequences, Escape Sequences
referring to astral plane characters via escapes, Refering to Astral Plane Characters via Escapes
Unicode normalization, Unicode Normalization
normalization, Important Unicode Concepts
Unicode escape sequences (source code), Source Code Internally
unit testing tools, More Tools
unwrapping primitives, Wrapping and Unwrapping Primitives
URIError constructor, Error Constructors
URIs
encoding and decoding, Encoding and Decoding Text
UTC (Coordinated Universal Time), Dates, Date Constructor Methods
UTF-16, String Constructor Method, Extract Substrings, Unicode Encodings
JavaScript source code internally treated as, Source Code Internally
translating JavaScript code into, Refering to Astral Plane Characters via Escapes
UTF-32, Unicode Encodings
UTF-8, Important Unicode Concepts, Unicode Encodings

V

V8 (JavaScript engine), Historical JavaScript Milestones
valueOf() method, Conversion to Primitive
unwrapping primitives, Wrapping and Unwrapping Primitives
values, ValuesBooleans, ValuesExamples: ToPrimitive() in action
categorizing using typeof and instanceof, Categorizing Values Using typeof and instanceof, Categorizing Values via typeof and instanceofObject Operators
converting to objects, Converting Any Value to an Object
fundamental types of, An Overview of the Syntax
JavaScript type system, JavaScript’s Type System
objects, Objects, Objects
primitive values, Primitive Values, Primitive Values
primitive values versus objects, Primitive Values Versus Objects, Primitive Values Versus Objects
properties, Values
type coercion, Type CoercionExamples: ToPrimitive() in action
undefined and null, undefined and null, undefined and nullWrapper Objects for Primitives
changing undefined values, Changing undefined
checking for either undefined or null, Checking for either undefined or null
checking for null, Checking for null
checking for undefined, Checking for undefined
checking for undefined or null, Checking for undefined or null
history of, The History of undefined and null
occurrences of null, Occurrences of null
occurrences of undefined, Occurrences of undefined
wrapper objects for primitives, Wrapper Objects for PrimitivesType Coercion
variables
assigning value to, An Overview of the Syntax
assigning values to, An Overview of the Syntax, Assignment
checking for existence of, Checking whether a variable exists
declaring, Variables and Assignment, An Overview of the Syntax
declaring and assigning, Declaring and Assigning Variables
documenting, Documenting Variables, Parameters, and Instance Properties
hoisting of variable declarations, Function Declarations Are Hoisted, Hoisting
introducing new scope with IIFE pattern, The IIFE Pattern: Introducing a New Scope
names of, Identifiers and Variable Names
required explicit declaration in strict mode, Variables Must Be Declared in Strict Mode
scoping and closures, Variable Scoping and Closures, Declaring a VariablePitfall: Inadvertently Sharing an Environment
closures, Closures, Closures: Functions Stay Connected to Their Birth Scopes
environments, Environments: Managing Variables
function scope, Variables Are Function-Scoped
function-scoped variables, Variables Are Function-Scoped
global object, The Global Object
global variables, Global Variables
hoisted variable declarations, Variables Are Hoisted, Variable Declarations Are Hoisted
IIFE applications, IIFE Applications
IIFE variation, prefix operators, IIFE Variation: Prefix Operators
IIFE with parameters, IIFE Variation: An IIFE with Parameters
introducing new scope via IIFE, Introducing a New Scope via an IIFE
scope, Background: The Scope of a Variable
static versus dynamic (semantics), Background: Static Versus Dynamic
undeclared variables become global in sloppy mode, Variable Declarations Are Hoisted
style guide, Variables
uninitialized, Occurrences of undefined
void operator, The void Operator
reason for its existence, Why does JavaScript have a void operator?
use cases, What is void used for?

W

web platform
as native platform, Historical JavaScript Milestones
JavaScript as part of, The Nature of JavaScript
WebKit, Historical JavaScript Milestones
WebOS, Historical JavaScript Milestones
while loop, Loops
whitespace in code, Syntax
window object, Cross-Platform Considerations
checking if global variable exists, Use case: checking whether a global variable exists
creating things in global scope, Use case: creating things in global scope
not referring to built-in globals via window, Use case: built-ins
use cases for window, Use case: marking global variables
Windows 8, Historical JavaScript Milestones
with statement, The with StatementThe Rationale for the Deprecation
deprecated, The with Statement Is Deprecated
rationale for deprecation, The Rationale for the Deprecation
techniques for avoiding use of, Techniques for avoiding the with statement
wrapper objects for primitives, Wrapper Objects for PrimitivesType Coercion
differences between wrapper objects and primitives, Wrapper Objects Are Different from Primitives
lenient equality (==) not working for, Use case: comparing wrapper instances with primitives

X

XMLHttprequest, Historical JavaScript Milestones
XRegExp library, Four Language Libraries

Y

Yeoman suite of tools, More Tools
YUI Compressor (minification tool), More Tools

Z

zero (0), positive and negative, Two ZerosDistinguishing the two zeros