Calling Versus Referencing 104
Do Arguments Make the Function? 107
Functions as Properties of Objects 109
The this Keyword 110
Function Expressions and Anonymous Functions 112
Arrow Notation 113
Conclusion 116
7.
Lexical Versus Dynamic Scoping 118
Global Scope 119
Block Scope 121
Variable Masking 121
Functions, Closures, and Lexical Scope 123
Immediately Invoked Function Expressions 124
Function Scope and Hoisting 125
Strict Mode 128
Conclusion 129
8.
Array Content Manipulation 132
Adding or Removing Single Elements at the Beginning or End 133
Adding Multiple Elements at the End 133
Adding or Removing Elements at Any Position 134
Cutting and Replacing Within an Array 134
Filling an Array with a Specific Value 135
Reversing and Sorting Arrays 135
Array Searching 136
The Fundamental Array Operations: map and filter 138
Array Methods and Deleted or Never-Defined Elements 143
String Joining 143
Conclusion 144
viii | Table of Contents