Index

Symbols

* (asterisk), multiplication operator, 20, 151

[] (brackets)

array declaration, 140

property definition, 167

|| conditional operator, 35

&& conditional operator, 35

< conditional operator, 35

<= conditional operator, 35

> conditional operator, 35

>= conditional operator, 35

{ } (curly braces) in functions, 23

-- (decrement operator), 152, 153

- = (decrement operator), 152

/ = (division operator), 152

= = (equality operator), 35

comparison with == = strict equality operator, 192-194, 198

/ (forward slash), division operator, 151

+ + (increment operator), 152, 153

!= (inequality operator), 35

comparison with != = strict inequality operator, 192-194

- (minus sign), subtraction operator, 151

%= (modulus operator), 152

/*.*/ (multi-line comments), 104

*= (multiplication operator), 152

( ) (parentheses)

in functions, 23

in IIFE, 203-204

in mathematical expressions, 151

% (percent sign), modulus operator, 151

+ (plus sign)

addition operator, 151

concatenation operator, 125-126

+ = (plus-equal sign)

concatenation operator, 125-126

increment operator, 152

““ (quotation marks) in strings, 11, 123

; (semicolon) in statements, 11

// (single line comments), 103-104

= = = (strict equality operator), 35

comparison with = = equality operator, 192-194, 198

!== (strict inequality operator), 35

comparison with != inequality operator, 192-194

A

abs( ) function (Math object), 159

absolute paths, referencing JavaScript files, 94-96

absolute value, 159

accessibility tools, DOM and, 278

accessing

all children, 261

array values, 141-142

characters in strings, 124-125

Developer Tools, 280-282

acos( ) function (Math object), 158

add method (classList API), 250-251

addEventListener function, 302-304, 341-342

adding

class values, 250-251

items to arrays, 143-144

addition operator, 151

alert function, 11

arguments, 24

console.log function versus, 296

altKey property (keyboard events), 342

animation, requestAnimationFrame function, 62-64

anonymous functions, 202

appendChild function, 267-268

arguments

for event handlers, 307-308

for functions, 24-27

in IIFE, 204

Array object, 117, 134

concat method, 147

indexOf method, 146-147

lastIndexOf method, 146-147

length property, 142

pop method, 145

push method, 143

shift method, 145

shuffling arrays example (extending objects), 179-180

slice method, 146

unshift method, 143-144

arrays

accessing values, 141-142

adding items to, 143-144

declaring, 140-141

finding items in, 146-147

in for loops, 54-55

merging, 147

removing items from, 145-146

shuffling arrays example (extending objects), 179-180

arrow key actions, 344-345

asin( ) function (Math object), 158

asterisk (*), multiplication operator, 20, 151

async attribute (script tag), 358-359

atan( ) function (Math object), 158

attribute selectors, 234

attribute values, modifying in DOM elements, 242-244

B

block scope, 71-72

Boolean function, 190-192

Boolean Logic, 37

Boolean object, 117, 134, 190

Boolean type, 114

booleans

initializing variables as, 189

as primitives, 190

brackets ([])

array declaration, 140

property definition, 167

break keyword

in for loops, 53

in switch statements, 41-42

breakpoints

removing, 293

setting, 288

browser Developer Tools. See Developer Tools

browser-specific mouse position, 334-335

bubbling events phase, 318

usage examples, 322-324

when to use, 319

built-in objects. See objects; primitives

button detection mouse properties, 335-336

button property (MouseEvent object), 335-336

buttons property (MouseEvent object), 336

C

calling functions, 22, 23

within functions, 78-81

cancelAnimationFrame function, 63

canceling

animation frames, 63

looping timers, 62

timers, 60

capturing events phase, 316

usage examples, 322-324

when to use, 319

Cascading Style Sheets. See CSS

case (of strings), changing, 130

case statements in switch statements, 39-42

ceil( ) function (Math object), 157

characters in strings

accessing, 124-125

finding, 129-130

charAt method (String object), 125

charCode property (keyboard events), 342, 343-344

child objects, 170, 258

accessing all, 261

checking existence, 261

event listening on, 367-370

mouse events and, 329

properties, 259-260

children property, 259-260

class values

adding, 250-251

checking existence, 252

removing, 251

toggling, 251

classList API, 250-252

className property, 244

clearInterval function, 62

clearTimeout function, 60

click event, 303, 326-327

clientX property (MouseEvent object), 334-335

clientY property (MouseEvent object), 334-335

cloneNode function, 273-276

cloning DOM elements, 273-276

closures, 77-78, 81-86

outer variable references, 207-212

code collision avoidance, 206-207

Code Convention, 16

code editors, 8

code placement options, 90-92, 355-358, 360-361

in HTML document, 92-93

in separate file, 93-96

which to use, 97-99

code privacy, providing, 213-216

combining strings, 125-126

comments

best practices, 106-107

JSDoc comments, 105

multi-line comments, 104

single line comments, 103-104

when to use, 102-103

complex expressions in if/else statements, 36-37

concat method

Array object, 147

String object, 126

concatenating strings, 125-126

conditional operators, 34-36

conditional statements

if/else statements, 32-34

complex expressions, 36-37

conditional operators in, 34-36

switch statement comparison, 42-44

when to use, 44-45

if/else-if/else statements, 38-39

if-only statements, 38

switch statements, 39-42

if/else statement comparison, 42-44

when to use, 44-45

console (Developer Tools), 293

console.log function, 296

constants, 155-157

constructor functions, 135

contains method (classList API), 252

context menus, disabling, 332-333

contextmenu event, 332-333

continue keyword, 53

converting strings to numbers, 154

cos( ) function (Math object), 158

create method (Object type), 171-174

createElement method (DOM), 266

Crockford, Douglas, 16

CSS (Cascading Style Sheets)

purpose of, 222-223

selector syntax, 234-235

styling directly, 249-250

CSS Zen Garden, 5-6

ctrlKey property (keyboard events), 342

curly braces ({ }) in functions, 23

currentTarget property (Event type), 308

cursor. See mouse

custom objects, creating, 169-174

D

Date object, 117, 134

Date.now( ) function, 83

dblclick event, 303, 327-328

debugging JavaScript, 287-293

decisions. See conditional statements

declaring

arrays, 140-141

functions, 22-23

variables, 14-15, 16-17

decrementing

for loops, 54

with operators, 152-153

default statements, 42

defer attribute (script tag), 358, 359-360

defining

methods, 168-169

properties, 167-169

delays. See timers

detail property (DOMMouseScroll event), 336-337

Developer Tools, 279

accessing, 280-282

console, 293

debugging JavaScript, 287-293

DOM view, 282-287

inspecting objects, 294-295

logging messages, 296

disabling context menus, 332-333

distance calculation example, 20-21

division operator, 151

document object, 228-229, 256-257, 354

Document Object Model. See DOM (Document Object Model)

documents (HTML). See HTML documents

document.writeln function, 50

DOM (Document Object Model), 225-226

accessibility tools and, 278

cloning elements, 273-276

code placement and, 355-358

creating elements, 266-271

document object, 228-229

event paths, 312-316

JavaScript objects comparison, 238-240

modifying elements, 240-241

attribute values, 242-244

text values, 242

navigating, 256-258

accessing all children, 261

checking child existence, 261

child relationships, 259-260

parent and sibling relationships, 259

usage examples, 262

nodes, 225-226

removing elements, 271-273

searching in

CSS selector syntax, 234-235

querySelector function, 233

querySelectorAll function, 233-234

viewing in Developer Tools, 282-287

window object, 227

DOMContentLoaded event, 303, 353-355, 358

DOMMouseScroll event, 303, 336-337

dot notation, 167

do...while loops, 56-57

E

E property (Math object), 155

else if statements, 38-39

equality operator (= =), 35

comparison with == = strict equality operator, 192-194, 198

Event Bubbling Phase, 318

usage examples, 322-324

when to use, 319

Event Capturing Phase, 316

usage examples, 322-324

when to use, 319

event handlers, 304

arguments, 307-308

as functions, 304-305

usage examples, 305-307

event targets, 314

Event type, 308

events

definition, 300-302

DOM paths of, 312-316

handling. See event handlers

interrupting, 319-321

keyboard events

arrow key actions, 344-345

detecting particular keys, 343-344

list of, 340-341

listening for, 341-342

multiple key presses, 345-347

properties, 342-343

list of, 303

listening for

addEventListener function, 302-304

in document object, 354

interrupting, 319-321

keyboard events, 341-342

on multiple elements, 365-371

phases, 316-319

removeEventListener function, 309

mouse events

click, 326-327

contextmenu, 332-333

dblclick, 327-328

DOMMouseScroll, 336-337

list of, 326

mousedown, 330-331

mouseenter, 329

mouseleave, 329

mousemove, 331

mouseout, 328-329

mouseover, 328-329

mouseup, 330-331

mousewheel, 336-337

MouseEvent object, 333

browser-specific mouse position, 334-335

button detection, 335-336

global mouse position, 333-334

scroll wheel movement, 336-337

page loads

DOMContentLoaded and load events, 353-355

steps in, 350-353

usage examples, 305-307

exiting functions early, 28-29

exp( ) function (Math object), 158

extending objects

array shuffling example, 179-180

prototype property, 181-185

reasons against, 185-186

F

files, JavaScript in, 91, 93-96

finding

characters in strings, 129-130

items in arrays, 146-147

firstChild property, 259-260

floor( ) function (Math object), 157

for loops, 49-50, 52

accessing array values, 142

arrays, 54-55

decrementing, 54

iterations, 51-52

missing sections, 55

non-numerical iterations, 54

skipping iterations, 53

starting condition, 51

stopping early, 53

terminating condition, 51

forward slash (/), division operator, 151

function keyword, 22

Function object, 117, 134

functions. See also methods

abs( ), 159

acos( ), 158

addEventListener, 302-304, 341-342

alert, 11

arguments, 24

console.log function versus, 296

anonymous functions, 202

appendChild, 267-268

arguments, 24-27

asin( ), 158

atan( ), 158

Boolean, 190-192

calling, 22, 23

cancelAnimationFrame, 63

ceil( ), 157

clearInterval, 62

clearTimeout, 60

cloneNode, 273-276

closures, 77-78, 81-86

console.log, 296

constructor functions, 135

cos( ), 158

Date.now( ), 83

declaring, 22-23

definition, 22

distance calculation example, 21

document.writeln, 50

event handlers, 304-305

exiting early, 28-29

exp( ), 158

floor( ), 157

within functions, 78-81

shared variables, 81-86

getDistance, 27-28

getElementById, 235

getElementsByClassName, 235

getElementsByTagName, 235

IIFE

arguments in, 204

code collision avoidance, 206-207

creating, 203-204

hidden code, 213-216

outer variable references, 207-212

when to use, 205-206

initializing variables in, 72-74

insertAfter, 271

insertBefore, 268-270

pow( ), 158

purpose of, 201

querySelector, 233, 234-235, 257

querySelectorAll, 233-235, 257

random( ), 159

removeChild, 271-273

removeEventListener, 309

requestAnimationFrame, 62-64

returning data, 27-28

round( ), 157

scope and, 70-71, 205

setInterval, 61-62

setTimeout, 60-61

showDistance

arguments, 25-26

returning data, 27

sin( ), 158

sqrt( ), 158

tan( ), 158

G

getAttribute method, 242-244

getDistance function, 27-28

getElementById function, 235

getElementsByClassName function, 235

getElementsByTagName function, 235

global mouse position, 333-334

global scope, 16-17, 68-69

H

handling events. See event handlers

Hello, World! example, 9-10

hidden code with IIFE, 213-216

hoisting variables, 72-74, 205

hovering. See mouseover event

HTML (Hypertext Markup Language)

purpose of, 220-222

styling, 247-248

with classList API, 250-252

directly with style object, 249-250

with JavaScript, 248

HTML documents

code placement within, 90, 92-93

CSS, purpose of, 222-223

Hello, World! example, 9-10

HTML, purpose of, 220-222

JavaScript, purpose of, 223-224

page loads

DOMContentLoaded and load events, 353-355

steps in, 350-353

parsing, 96

script tag placement, 96, 355-358, 360-361

html object, 256-257

hybrid code placement option, 91-92

Hypertext Markup Language. See HTML

I

id property, 244

if/else statements, 32-34

complex expressions, 36-37

conditional operators in, 34-36

switch statement comparison, 42-44

when to use, 44-45

if/else-if/else statements, 38-39

if-only statements, 38

IIFE (Immediately Invoked Function Expression)

arguments in, 204

code collision avoidance, 206-207

creating, 203-204

hidden code, 213-216

outer variable references, 207-212

when to use, 205-206

incrementing with operators, 152-153

index positions, 124

index values of arrays, 142

indexOf method

Array object, 146-147

String object, 129-130

inequality operator (!=), 35

comparison with != = strict inequality operator, 192-194

Infinity keyword, 153

inheritance, 166, 170-171

initializing variables, 14-15, 16-17

as booleans, 189

in functions, 72-74

inner functions, shared variables, 81-86

insertAfter function, 271

insertBefore function, 268-270

inspecting objects, 294-295

interrupting events, 319-321

iterations

in for loops, 51-52

non-numerical, 54

skipping, 53

J

JavaScript

code placement options, 90-92, 355-358, 360-361

in HTML document, 92-93

in separate file, 93-96

which to use, 97-99

debugging, 287-293

definition, 7-8

purpose of, 223-224

JavaScript Variable Name Validator, 16

.js file extension, 93-94

JSDoc comments, 105

K

keyboard events

arrow key actions, 344-345

detecting particular keys, 343-344

list of, 340-341

listening for, 341-342

multiple key presses, 345-347

properties, 342-343

keyboards, 339

keyCode property (keyboard events), 342, 343-344

keydown event, 303, 340-341

listening for, 341-342

keypress event, 340-341

listening for, 341-342

keyup event, 303, 340-341

listening for, 341-342

keywords

break

in for loops, 53

in switch statements, 41-42

continue, 53

function, 22

Infinity, 153

let, 72

NaN, 154

null, 196-197

return

exiting functions early, 28-29

returning data, 27-28

this, 175-177

typeof, 137

var, 14, 70-71

L

lastChild property, 259-260

lastIndexOf method

Array object, 146-147

String object, 129-130

length property

Array object, 142

String object, 124

let keyword, 72

lexical scope, 205

listening for events

addEventListener function, 302-304

in document object, 354

interrupting, 319-321

keyboard events, 341-342

on multiple elements, 365-371

phases, 316-319

removeEventListener function, 309

literal notation, 167

literals, string, 123

LN2 property (Math object), 155

LN10 property (Math object), 155

load event, 303, 353-355

local scope, 70-71

locking in state, 207-212

LOG2E property (Math object), 155

LOG10E property (Math object), 155

logging messages, 296

loops

do...while loops, 56-57

for loops, 49-50, 52

accessing array values, 142

arrays, 54-55

decrementing, 54

iterations, 51-52

missing sections, 55

non-numerical iterations, 54

skipping iterations, 53

starting condition, 51

stopping early, 53

terminating condition, 51

types of, 48

while loops, 56

lowercase, changing strings to, 130

M

match method (String object), 130

Math object, 117, 134, 154-155. See also numbers

absolute value, 159

constants, 155-157

powers and square roots, 158-159

random numbers, 159

rounding numbers, 157

trigonometric functions, 158

merging arrays, 147

metaKey property (keyboard events), 343

methods. See also functions

add (classList API), 250-251

charAt (String object), 125

concat

Array object, 147

String object, 126

contains (classList API), 252

create (Object type), 171-174

createElement (DOM), 266

defining, 168-169

getAttribute, 242-244

indexOf

Array object, 146-147

String object, 129-130

lastIndexOf

Array object, 146-147

String object, 129-130

match (String object), 130

pop (Array object), 145

preventDefault (Event type), 308, 321, 333, 347

push (Array object), 143

remove (classList API), 251

setAttribute, 242-244

shift (Array object), 145

slice

Array object, 146

String object, 127

split (String object), 128-129

stopPropagation (Event type), 308, 320-321, 370

substr (String object), 127-128

toggle (classList API), 251

toLowerCase (String object), 130

toUpperCase (String object), 130

unshift (Array object), 143-144

minus sign (-), subtraction operator, 151

modifying DOM elements, 240-241

attribute values, 242-244

text values, 242

modulus operator, 151

mouse, 325

browser-specific mouse position, 334-335

button detection, 335-336

global cursor position, 333-334

scroll wheel movement, 336-337

mouse events

click, 326-327

contextmenu, 332-333

dblclick, 327-328

DOMMouseScroll, 336-337

list of, 326

mousedown, 330-331

mouseenter, 329

mouseleave, 329

mousemove, 331

mouseout, 328-329

mouseover, 328-329

mouseup, 330-331

mousewheel, 336-337

mousedown event, 330-331

mouseenter event, 329

MouseEvent object, 333

browser-specific mouse position, 334-335

button detection, 335-336

global mouse position, 333-334

scroll wheel movement, 336-337

mouseleave event, 329

mousemove event, 303, 331

mouseout event, 303, 328-329

mouseover event, 303, 328-329

mouseup event, 330-331

mousewheel event, 303, 336-337

multi-line comments, 104

multiple elements, events on, 365-371

multiple key presses, 345-347

multiplication operator, 20, 151

N

naming variables, 15-16

NaN keyword, 154

navigating DOM, 256-258

accessing all children, 261

checking child existence, 261

child relationships, 259-260

parent and sibling relationships, 259

usage examples, 262

nextSibling property, 259

nodes, 225-226

non-numerical iterations in for loops, 54

null keyword, 196-197

Null type, 114

Number object, 117, 134

Number type, 114

numbers. See also Math object

absolute value, 159

converting strings to, 154

Infinity keyword, 153

NaN keyword, 154

operators

incrementing and decrementing, 152-153

simple math, 151

powers and square roots, 158-159

random numbers, 159

rounding, 157

types, 150

usage examples, 150

O

object literal syntax, 163

Object type, 114, 162

create method, 171-174

creating objects, 163-166

DOM element comparison, 238-240

[[Prototype]] property, 166

objects, 115-116

child objects, 170, 258

accessing all, 261

checking existence, 261

event listening on, 367-370

properties, 259-260

constructor functions, 135

creating, 163-166

custom objects, creating, 169-174

document, 228-229, 256-257, 354

DOM element comparison, 238-240

extending

array shuffling example, 179-180

prototype property, 181-185

reasons against, 185-186

html, 256-257

inspecting, 294-295

list of, 117-118

methods, defining, 168-169

parent objects, 170, 258

event listening on, 367-370

properties, 259

properties, defining, 167-169

prototype, 165

prototypical inheritance model, 178

sibling objects, 258, 259

style, 249-250

temporarily converting primitives to, 133-138

this keyword, 175-177

window, 69, 227, 256-257

operators

conditional, 34-36

incrementing and decrementing, 152-153

simple math, 151

outer functions, shared variables, 81-86

outer variables, referencing, 207-212

P

page loads

DOMContentLoaded and load events, 353-355

steps in, 350-353

parent objects, 170, 258

event listening on, 367-370

properties, 259

parentheses (( ))

in functions, 23

in IIFE, 203-204

in mathematical expressions, 151

parentNode property, 259

parsing HTML documents, 96

percent sign (%), modulus operator, 151

phases (event listening), 316-318

usage examples, 322-324

when to use, 319

PI property (Math object), 155, 156-157

pizza metaphor (types), 110-113

plus sign (+)

addition operator, 151

concatenation operator, 125-126

pop method (Array object), 145

pow( ) function (Math object), 158

powers (Math object), 158-159

preventDefault method (Event type), 308, 321, 333, 347

previousSibling property, 259

primitives, 115

booleans as, 190

null, 196-197

object usage versus, 117-118

temporary conversion to objects, 133-138

undefined, 197-198

private code with IIFE, 213-216

properties, 162

child objects, 259-260

className, 244

CSS, styling directly, 249-250

for custom objects, 170-171

defining, 167-169

Event type, 308

id, 244

keyboard events, 342-343

MouseEvent object

browser-specific mouse position, 334-335

button detection, 335-336

global mouse position, 333-334

scroll wheel movement, 336-337

parent and sibling objects, 259

prototype, extending objects, 181-185

textContent, 242

this keyword, 175-177

__proto__ property, 164

prototype chains, 166, 170-171

prototype objects, 165

prototype property, extending objects, 181-185

[[Prototype]] property, 166

prototypical inheritance model, 178

push method (Array object), 143

Q

querySelector function, 233, 234-235, 257

querySelectorAll function, 233-235, 257

quotation marks (““) in strings, 11, 123

R

random( ) function (Math object), 159

random numbers, 159

referencing

JavaScript files, 94-96

outer variables, 207-212

RegExp object, 117, 134

relative paths, referencing JavaScript files, 94-96

remove method (classList API), 251

removeChild function, 271-273

removeEventListener function, 309

removing

breakpoints, 293

class values, 251

DOM elements, 271-273

items from arrays, 145-146

repeats. See loops

requestAnimationFrame function, 62-64

requestID variable, 64

return keyword

exiting functions early, 28-29

returning data, 27-28

returning data from functions, 27-28

within functions, 78-81

Revealing Module Pattern, 215

right-click menus, disabling, 332-333

round( ) function (Math object), 157

rounding numbers, 157

S

scope of variables

block scope, 71-72

closures, 77-78, 81-86

global scope, 16-17, 68-69

initializing variables in functions, 72-74

inspecting objects, 295

lexical scope, 205

local scope, 70-71

var keyword, 70-71

screenX property (MouseEvent object), 333-334

screenY property (MouseEvent object), 333-334

script tag, 9-10

async attribute, 358-359

code placement within, 92-93

defer attribute, 358, 359-360

placement in HTML document, 96, 355-358, 360-361

referencing JavaScript files, 94-96

scroll event, 303

scroll wheel movement, 336-337

searching in DOM

CSS selector syntax, 234-235

querySelector function, 233

querySelectorAll function, 233-234

semicolon (;) in statements, 11

setAttribute method, 242-244

setInterval function, 61-62

setTimeout function, 60-61

shared variables in inner functions, 81-86

shift method (Array object), 145

shiftKey property (keyboard events), 342

showDistance function

arguments, 25-26

returning data, 27

shuffling arrays example (extending objects), 179-180

sibling objects, 258, 259

sin( ) function (Math object), 158

single line comments, 103-104

slice method

Array object, 146

String object, 127

split method (String object), 128-129

sqrt( ) function (Math object), 158

SQRT1_2 property (Math object), 155

SQRT2 property (Math object), 155

square brackets ([])

array declaration, 140

property definition, 167

square roots, 158-159

src attribute (script tag), 94-95

starting condition in for loops, 51

state, locking in, 207-212

statements

case, 39-42

conditional

if/else statements, 32-34

if/else-if/else statements, 38-39

if-only statements, 38

switch statements, 39-42

default, 42

definition, 10

loops

do...while loops, 56-57

for loops, 49-50, 52

types of, 48

while loops, 56

semicolon (;) in, 11

stepping through code, 290-292

stopPropagation method (Event type), 308, 320-321, 370

strict equality operator (= = =), 35

comparison with = = equality operator, 192-194, 198

strict inequality operator (!= =), 35

comparison with != inequality operator, 192-194

string literals, 123

String object, 117, 134

charAt method, 125

concat method, 126

indexOf method, 129-130

lastIndexOf method, 129-130

length property, 124

match method, 130

slice method, 127

split method, 128-129

substr method, 127-128

toLowerCase method, 130

toUpperCase method, 130

String type, 114

strings, 121-123

accessing characters in, 124-125

changing case, 130

concatenating, 125-126

converting to numbers, 154

finding characters within, 129-130

primitive versus object forms, 134-136

quotation marks (““) in, 11, 123

substrings, 126

slice method, 127

split method, 128-129

substr method, 127-128

style object, 249-250

styling HTML elements, 247-248

with classList API, 250-252

directly with style object, 249-250

with JavaScript, 248

substr method (String object), 127-128

substrings, 126

slice method, 127

split method, 128-129

substr method, 127-128

subtraction operator, 151

switch statements, 39-42

if/else statement comparison, 42-44

when to use, 44-45

T

tags. See script tag

tan( ) function (Math object), 158

target property (Event type), 308

terminating condition in for loops, 51

text values, modifying in DOM elements, 242. See also strings

textContent property, 242

this keyword, 175-177

timeID variable, 60

timers

canceling, 60

requestAnimationFrame function, 62-64

setInterval function, 61-62

setTimeout function, 60-61

toggle method (classList API), 251

toggling class values, 251

toLowerCase method (String object), 130

toUpperCase method (String object), 130

trigonometric functions, 158

true/false. See booleans

type coercion, 193

type property (Event type), 308

typeof keyword, 137

types

list of, 113-115

for numbers, 150

objects, 115-116

list of, 117-118

pizza metaphor, 110-113

primitives, 115

U

undefined primitive, 197-198

Undefined type, 114

unshift method (Array object), 143-144

uppercase, changing strings to, 130

V

values

of arrays, accessing, 141-142

definition, 14

null, 196-197

undefined, 197-198

var keyword, 14, 70-71

variables

arguments as, 26

declaring, 14-15, 16-17

definition, 14

hoisting, 72-74, 205

initializing, 14-15, 16-17

as booleans, 189

in functions, 72-74

naming, 15-16

outer variables, referencing, 207-212

requestID, 64

scope

block scope, 71-72

closures, 77-78, 81-86

global scope, 16-17, 68-69

inspecting objects, 295

lexical scope, 205

local scope, 70-71

var keyword, 70-71

shared variables in inner functions, 81-86

timeID, 60

View Source command (Developer Tools), 284-287

viewing DOM in Developer Tools, 282-287

W

web documents. See HTML documents

wheelDelta property (mousewheel events), 336-337

which property (MouseEvent object), 336

while loops, 56

whitespace in comments, 106

window object, 69, 227, 256-257

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.163.13