Index

Symbols

* (asterisk) character, 52, 101

(backslash) character, 120, 141

` (backtick) character, 119, 141, 143

= (equals) character, 47, 107

+ (plus) operator, 111, 119, 120

; (semicolon) character, 76

{ } (curly braces), 161, 173, 288, 296, 319

[ ] (square brackets), 189, 288, 296, 319

" (double quote) character, 119, 141, 143

' (single quote) character, 119, 141, 143

A

<a> tag, 4142

about this book, xvxvii

abstraction, 305, 344345

acceleration values, 458

activeGame object, 442

addEventListener method, 429

adding machine program, 122, 124126

addition service, 398, 399400

addStock function, 361362

alert function, 12, 52, 213

alertInputText ID, 46

aligning text, 71, 88

alternative text, 39

analyzing data, 370371

Andreessen, Marc, 28

animating images, 427429

anonymous functions

awaits contained in, 468

code analysis of, 375376

explanation of, 374, 402, 405

simplifying promises using, 383

appendChild method, 200

applets, 5

applications

adding machine, 122, 124126

data-processing, 9697

digital dice, 222232, 236

egg timer, 5256

fashion shop, 335363, 368379

ice cream sales, 242269

multiplication table, 196203

pizza calculator, 127131

ride selector, 161172, 178196

temperature conversion, 130131

ticking clock, 7277

tiny contacts, 276316

totalizer, 133137

weather information, 379387

See also programs

arc drawing method, 417

arguments

arrays of, 221

code analysis of, 214216

maximum number of, 238

ordering of, 18

parameters and, 216217

references used as, 219220

arrays, 221, 246251

bounds of, 271

code analysis of, 267268

counting from zero in, 249

filter method, 377

investigating and creating, 246248

as lookup tables, 265266

map method, 378379

processing data in, 249251

reduce method, 378

size of, 268, 271

sorting data in, 371373

storing data in, 246248, 281283

arrow functions, 374375, 376, 402, 405, 463

artificial intelligence (AI), 456457

artwork

computer-generated, 414419

drawing on canvas, 410413, 419425

assign function, 356

assignment operation, 46

asterisk (*) character, 52, 101

async keyword, 424425, 426

asynchronous operations, 380, 420

attract mode for games, 468

attributes

data, 184188

image tag, 38

properties vs., 60

style, 64, 80, 87

Audacity program, 453

audio

adding, 55, 140, 452453

playback control, 56, 140

audio element, 55, 56

await keyword, 424425, 426, 467468

Azure account, 401

B

backslash () character, 120, 141

backtick (`) character, 119, 141, 143

bad nesting, 37

Berners-Lee, Tim, 28

binary representation, 104

binding event handlers, 421

bits, 103, 104

block-copy commands, 342

blocks of statements

for loop and, 193

if construction and, 160161

blur event, 435

Boolean expressions, 149150

Boolean function, 147, 149

Boolean values, 146149, 173, 174

bounds of the array, 271

<br> tag, 31, 34

bracket notation, 300, 317

break keyword, 171

breakpoints, setting, 262

browsers. See web browsers

bugs

faults vs., 67, 181

fixing in programs, 181183

responding to reports of, 181

See also errors

buildElementsFromSchema method, 358

buttons, creating HTML, 4244

C

C# and C++ programming languages, 4, 346

calculations

examples of, 1012

performing, 110112, 244245

calling functions, 208, 209, 210211

camel case, 108

canvas, 410425

computer art program, 414419

coordinates, 413414

drawing on, 410413, 419425, 468

cascading styles, 8586, 88

case sensitivity, 310, 317

catch block, 326, 327, 328

catch method, 384, 386, 426

changeArrayElement function, 267

children property, 189

class attribute, 82, 84, 90

classes, 335, 363364, 365

constructor method for, 339340, 342

diagram created for, 343344

game sprite, 438, 440441

hierarchy of, 345, 347348

inheritance mechanism for, 343344, 345347

method members added to, 348349

object-oriented design and, 341342

static members of, 352355, 357

style, 82, 84

className property, 180

cloning repositories, 1819

code

avoiding repeated, 343

bugs vs. faults in, 67, 181

building web pages from, 196201

debugger for running, 260264

finding and fixing bugs in, 181183

importance of well-designed, 183184

code analysis, xvi

addition service, 399400

anonymous functions, 375376

arguments, 214216

arrays, 267268

Boolean values, 147149

code errors and testing, 109110

commands and responses, 1012

comparison operators, 151152

doSave function, 286287

doShowAlert function, 4748

evaluating expressions, 100102

exception handling, 327330

findContacts function, 284

floating-point values, 114115

for loop, 192194

functions, 209212

game class, 440441

getNumberFromElement function, 230231

HTML from JavaScript, 199201

if constructions, 160

input generation, 256257

JSON, 299

keyboard events, 430431, 432433

logical operators, 154156

multiple path use, 394396

performing calculations, 112

player sprite, 445446

promises, 385387

reading numbers, 259260

server use, 390392

sorting items, 372373

Super Search, 314315

ticking clock program, 75

whole vs. real numbers, 113

collections

arrays as, 221

for-of loop and, 195196, 221

collision detection, 455

colors

adding, 6465

creating, 418

keyword, 24

mouse rollover, 6667

comments

adding to programs, 131133, 141

HTML, 38, 133

comparison function, 371372, 373, 374, 402

comparison operators, 150152

compiled languages, 23, 102

computers

art generated by, 414419, 440

data processing by, 9697, 140

minimum requirements for, xvii

concat method, 272

concatenation, 119, 272

confirm function, 334

console.log statement, 192

Console window, 9

const keyword, 332, 354

constructive laziness, 195

constructor method

class creation and, 339340, 342

objects and, 340341

contacts app, 276316

displaying contacts in, 285

finding contacts in, 283285, 287, 309315

helper functions, 280281

JSON for encoding data in, 295298

local storage for, 292295

objects used in, 291292

property accessors in, 300304

prototype creation, 277280

saving contacts in, 285287

schemas created for, 304308

storing contacts in, 281283

Super Search feature for, 310315

user ideas for improving, 310, 316

container element, 306

control variables, 191

controller function, 422

coordinates, canvas, 413414

Cracker Chase game, 436465

AI added to, 456457

class definition, 438, 440441

code analysis, 438, 440441

collision detection, 455

end detection, 464

game object, 439440

physics and friction, 457458, 459

running, 463464

scores added to, 453454, 464

sound added to, 452453

sprites in, 436438, 443452, 456460

start screen added to, 461462, 463

createElement method, 199, 255, 380

createListElement function, 369370

createListPage function, 369

createServer method, 389390, 395, 404

CSS (Cascading Style Sheets), 82, 8586, 89, 91

See also style sheets

curly braces { }, 161, 173, 288, 296, 319

currentDate variable, 72, 73

D

data

analyzing, 370371

fetching, 380385

information vs., 103

sorting, 371373, 376377, 402

text vs. numeric, 112

data attributes, 184188

adding to HTML elements, 184185

code analysis of, 186187

data processing

arrays and, 249251

computers and, 9697, 140

expressions for, 100102

JavaScript, 99, 100, 104

programs and, 9899

data schemas. See schemas

Date object, 72, 149

debugger feature, 260264

default selector, 170

defining functions, 208, 209210, 213

delimiters, 119

designing

systems before building, 305, 341342

user interface for customers, 162, 252254

Developer view, 78

digital dice program, 222232

double dice version of, 236

error handling added to, 227232

random number calculations in, 222226

disabled attribute, 385

displayContact function, 292

displayElementValue function, 280, 285

displaying

images, 57

symbols, 3233

text, 4950, 462

displayMessage function, 462

<div> element, 8485, 88, 90, 253

doAddition function, 9, 124

doAddToTotal function, 136

doBuildPage function, 305, 306, 307

doBuildSalesInputItems function, 253254, 256

doCalc function, 244245, 251, 262

doClockTick function, 74, 7677

Document Object Model (DOM), 45, 252

documents

deleting elements from, 201202

HTML formatting of, 41

style sheets added to, 80, 88

doEndTimer function, 52, 54

doFind function, 287, 312313

doGame function, 441

doMouseOver function, 66

doSave function, 285, 286287

doSaveAdd function, 362

doShowAlert function, 4748

doStartClock function, 7677

doStartFashionShop function, 360

doStartTimer function, 52

doStartTinyContacts function, 298

dot notation, 300, 317

double quote (") character, 119, 141, 143

doUpdateItem function, 370

doValidate function, 327, 328

downloads for book, xviii

draw method, 440, 445

drawImage function, 427, 445

drawing

on canvas, 410413, 419425, 468

computer-generated, 414419, 440

drawStartScreen method, 462, 463

E

egg timer program, 5256

functions used in, 52

investigation exercise, 5354

sound added to, 55

Eich, Brendan, 5

elements, 37, 46, 58, 246

Elements window, 8

else keyword, 159, 160, 174

<em> tag, 30, 60

em units, 70, 88, 90

emojis, meanings of, 33

empty objects, 288, 300, 316

encapsulation, 234

end method, 392

end tags, 32

entryDelay value, 459460

equality operator, 151, 152, 153, 174

equals (=) character, 47, 107

error handling

adding to applications, 227232

JavaScript promises and, 384

errors

exceptions and, 330334, 363

finding in advance, 228233

floating-point values and, 114115

importance of managing, 335

logic, 109110

spelling, 110

testing for, 110, 126

See also bugs; faults

escape sequences, 120, 141, 143

event handlers, 421

events

attributes of, 87

definition of, 421

keyboard, 430435

window, 429430

exceptions

catching, 327

errors and, 330334, 363, 386

explanation of, 299, 324, 364365

handling of, 327330

JSON use of, 299, 324, 325326

Express system, 401

expressions

Boolean, 149150

evaluated by JavaScript, 100102, 111

operators and operands in, 100, 110, 141

processing data with, 100

F

F12 key, 7, 23

false keyword, 146, 147148

fashion shop application, 335363, 368379

adding stock items, 361362

class hierarchy, 347348

code exploration, 362

data analysis, 370371

data storage solutions, 355356

HTML creation, 359360

illustrated overview, 335338

menu options, 361

sorting data, 371372, 376377

starting the program, 360

static class members, 352355

store stock data, 339340, 368370

suggestions for expanding, 363

user interface, 357359, 361

faults

bugs vs., 67, 181

fixing in programs, 181183

responding to reports of, 181

types of, 330331

See also errors

fetch function, 381382, 403, 404

fetching data, 380385

asynchronous operation for, 380

calling web services and, 399400

disabling FETCH button after, 384385

promises used for, 381384

fetchPromise object, 381

files

finding, 21

saving, 20

fillRect function, 418

fillText method, 454

filter method, 377, 402

finally function, 385, 387, 403

findContactPos function, 283, 284, 285, 286, 287

findContacts function, 284

finding

files in Visual Studio Code, 21

info in contacts app, 283285

Super Search for, 310315

findStartsWithDataPos function, 313, 314

firewalls, 391

fixed-width layouts, 268269

floating-point numbers, 114116

equality and, 153

errors related to, 114115

real numbers and, 114

floor function, 117, 118, 129, 141

focus, loss of, 435436

fonts

families of, 68, 69, 87

monospaced vs. proportional, 36

selecting for text, 6869, 70

serif vs. sans-serif, 68, 70

size specification, 7071

for loop, 191195

code analysis, 192194

elements of, 191, 203

findContacts function and, 284

for-of loop, 195196, 204, 221, 259

friction, game, 457458, 459

functions, 43, 61

anonymous, 374

arguments given to, 214216

arrow, 374375

calling, 208, 209, 210211

code analysis of, 209212

defining, 208, 209210, 213

designing with, 228

explanation of, 43, 208213

giving information to, 213

helper, 280281

local variables in, 233236

methods distinguished from, 61, 341, 365

multiple parameters in, 218

naming, 213, 239

side effects of, 136, 137

values returned from, 222226

G

game engines, 465

gameEnd method, 464

gameplay controls, 429436

event listener, 429430

keyboard events, 430435

lost focus and, 435436

window events, 429430

gameReset function, 442

gameRun method, 463

gameRunning property, 463, 464, 468

games

animating images for, 427429

artificial intelligence in, 456457

attract mode for, 468

building your own, 465

classes for, 438, 440441

code analysis for, 438, 440441

collision detection for, 455

controls for playing, 429436

drawing images for, 419421

end detection for, 464

event listener for, 429430

fixing problems in, 456

friction in, 458, 459

image loading promise for, 421425

including instructions with, 461

keyboard events for, 430435

losing focus in, 435436

making playable, 465

objects for, 436460

party, 137140

physics used in, 457458, 459

running, 441, 463464

scores added to, 453454, 464

sound added to, 140, 452453

sprites in, 436438, 443452, 456460

start screen for, 461462, 463

gameStart method, 441, 442, 463

gameUpdate function, 428, 433435, 442443, 463

“get” requests, 29

getAttribute method, 185, 186187

getDescription method, 349, 350352

getElementByID method, 4546, 47, 55

getElementValue function, 281

getHighest function, 250

getHours method, 72

getHTML method, 358359

getImages function, 423, 424

getItem method, 294, 295

getLargestStockRef method, 353, 354

getLowest function, 250

getNumberFromElement function, 226, 229, 230231, 260, 263

getRandomColor function, 418

getRandomInt method, 353, 417

getTestItems method, 353, 354

getTotal function, 250

Gimp program, 419

Git program, 1314

installing, 14

repositories in, 17

GitHub service, xviii, 16

private work on, 24

repositories on, 17

global variables, 134136, 142, 143, 235, 417

H

headers

function, 227, 237

response, 404

heading tags, 35

helper functions, 280281

hierarchy of classes, 345, 347348

High and Low game, 139

highlighting elements, 269

host element, 29, 393

hover selector, 87

href attribute, 41

HTML (Hypertext Markup Language), 12, 2750

audio element, 55, 56

badly formatted, 3738

button creation, 4244

canvas element, 410425, 468

comments added in, 38, 133

creating, 359360

data attributes in, 184188

document formatting, 41

heading creation, 35

how it works, 2932

images added in, 3840

input element, 4445, 244

JavaScript and, 4548, 58, 199201

links used in, 4142

origins and development of, 28

paragraph layout, 34

prototype example, 277278

routing in, 393394

schema for building, 305308, 358359

styles added to, 6485

symbol display, 3233

text display, 4950

validator site, 38

web servers and, 396

<html> tag, 41

HTTP and HTTPS protocols, 28, 29

Node.js platform and, 389390, 404

server requests vs. responses, 406

stateless description of, 407

I

i variable, 233, 236

ice cream sales program, 242269

arrays used in, 246248, 265268

collections of data in, 242246

detecting invalid values in, 251252

finding highest/lowest sales in, 249251

fixed-width layouts for, 268269

highlighting elements in, 269

user interface for, 252264

id attribute, 44, 58, 90

identifiers, 108109

identity operator, 152, 173, 174

if construction, 158161, 173, 174

blocks of statements in, 160161

else keyword added to, 159160, 174

Math.random function used in, 172

images

adding to web pages, 3840

alternative text for, 39

animating, 427429

drawing on a canvas, 419425

example of moving, 428429

file types for, 419420

loading and drawing, 420421

program for displaying, 57

promises for loading, 421425

<img> tag, 3840, 57, 419

index values, 271272

indexer or subscript, 246

infinity value, 11, 148

information vs. data, 103

inheritance, 343344, 345347, 364

innerText property, 51, 243

<input> tag, 4445, 244, 278, 318

input paragraphs, 254257, 258

input validation, 175

installing

Git program, 14

Node.js program, 387389

Visual Studio Code program, 1516

Internet of Things (IoT), 97

Internet vs. World Wide Web, 59

isNaN function, 230

J

Java programming language, 5, 346

JavaScript

Boolean thinking in, 146157

data processing in, 99, 100, 104

evaluating expressions with, 100102

examples of talking to, 1012

exceptions thrown by, 324, 364365

functions and statements in, 43

HTML and, 4550, 58, 199201

identifiers in, 108109

local storage, 292295

origins and intention of, 5

programming languages and, 45, 6, 23

prototype example, 279280

tools for working with, 13

variables in, 46, 58, 105108

web browsers and, 6

JPEG file format, 419

JSON (JavaScript Object Notation), 295299

adding type info to, 355356

class hierarchy and, 355

code analysis of using, 299

encoding object data with, 295298, 317

example of working with, 296297

exceptions thrown by, 299, 324, 325326

fetched data and, 382

validator web page, 327

JSONparse method, 356, 357

K

keyboard events, 430435

code analysis, 430431, 432433

gameUpdate function, 433435

object position control, 431, 432433

keydown event, 429430, 433, 463

keyup event, 431, 433

keywords, 24

L

label element, 244, 255

lambda functions, 375

layouts

fixed-width, 268269

paragraph, 34

styles vs., 81

length property, 271

let keyword, 193, 205, 235236, 238

letDemo function, 236

<li> element, 164, 188

lineTo method, 412

<link> element, 81

links, HTML, 4142, 81

listen method, 390, 392, 404

lists

creating, 369370

investigating, 189190

ordered, 164

unordered, 188

loadDataStore function, 331332

local storage, 292295, 317

explanation of, 292293

investigating the use of, 293295

web browsers and, 293, 318

local variables, 135, 233236

let keyword for, 235236

scope of, 234235

localhost address, 391

LocalStorage object, 293

logic errors, 109110

logical operators, 154157

lookup tables, 265266

loops

for, 191195

for-of, 195196

while, 201202

M

makeElement function, 307308, 315

makeInputPar function, 254, 255, 256

management

error, 335

local storage, 293

style, 86

manifest configuration file, 401

map method, 379, 402

margins, text, 7779, 88

markup languages, 2930

Math class, 354

Math.random function, 172

max attribute, 230231, 254

measureText method, 462

menuInput style, 229

menuInputError style, 229

menuLabel style, 269

message variable, 46

methods, 4546

adding to classes, 348349

functions distinguished from, 61, 341, 365

overriding in subclasses, 350352

Microsoft Paint program, 419

Microsoft Press resources, xix

min attribute, 230231, 254

mobile devices, xviii

modules, 389

monospaced font, 36

mouse rollover

color highlighting on, 6667

rollover style and, 87

moveTo method, 412

moving images, 428429

multiplication table program, 196203

code analysis, 199201

deleting elements from, 201202

displaying scores in, 270

ideas to investigate for, 202203

myCanvas variable, 411

myContext variable, 412

N

names

function, 213, 239

sorting array of, 373

NaN value, 11, 125, 141, 142, 148, 230, 231

Nerves of Steel game, 138

nesting, bad, 3738

Netscape Communications Corporation, 5

networks

JSON data received from, 383

text received from, 384

new keyword, 72, 75, 339, 364

Node.js program, 387401, 403404

HTTP module, 389390, 404

installing and testing, 387388

multiple path use, 394396

node package manager, 401, 404

purpose and limitations, 389

server deployment, 401

web server creation, 389400

node package manager (npm), 401, 404

notation

dot vs. bracket, 300, 317

JavaScript Object, 295299

null value, 299

Number function, 124, 125, 141, 142, 213

numbers

combining text and, 120121

converting text into, 122123

entering invalid, 125126

floating-point, 114116

random, 116118, 137139, 222226

reading, 259260

real, 112113, 114, 141

whole, 112113, 141

numeric operators, 111

O

obfuscator programs, 2324

object-oriented design

explanation of, 341342

inheritance mechanism in, 343344

objects, 288, 316317

abstraction using, 344345

class creation and, 339340

constructors and, 340341

creating, 288291, 339

empty, 288, 300, 316

example of using, 291292

JSON for encoding data in, 295298

polymorphism and, 350

position control for, 431

promise, 381382, 424, 426

properties of, 5051, 300, 316317

references to, 49, 60, 290291, 299, 317

schema for building, 308

storing data in, 288, 292293, 295

<ol> element, 164

onclick attribute, 43, 225, 236

onerror event, 421

oninput function, 313314, 315

onload event, 74, 77, 253, 421, 441

onmouseout event, 67

onmouseover event, 66, 86

openPage function, 361

OpenWeather service, 379, 398

operands, 100, 110, 141, 142

operators, 100, 110, 141, 142

comparison, 150152

logical, 154157

numeric, 111

ordered lists, 164

overlapping elements, 37

overriding methods, 350352

P

<p> tag, 34

paragraphs

creating input, 254257, 258

laying out text in, 34

parameters

arguments and, 216217

functions with multiple, 218

as values, 217

parse method

JSON strings and, 297, 299, 317, 325326

URL strings and, 395396, 397

party games, 137140

paths

defining and drawing, 412

in URL structure, 29, 393

using multiple, 394396

Petzold, Charles, 104

Phasor game engine, 465

physics of games, 457458, 459

pixels, 39, 78, 88, 90

pizza calculator, 127129

playback control, 56, 140

player sprite, 445446

plus (+) operator, 111, 119, 120

PNG file format, 419

polymorphism, 350

pos variable, 284, 285

<pre> tag, 3536

preformatted text, 3536, 59

Preview image editor, 419

print function, 12

problem solving, 311

programming languages, 45, 6

compiled, 23

determining the “best,” 5

scripting, 23, 102

programs

audio added to, 55

bugs vs. faults in, 67

comments added to, 131133, 141

data processing in, 9899

error handling for, 227232

good specifications for, 134

interpreting, 102

user interface for, 162, 163165

variables in, 105108

See also applications

Promise.all method, 422423, 426

promises, 381387, 405406

controller function for, 422

explanation of, 381382, 386, 403, 405

finally function in, 385

handling errors in, 384

image loading, 421425

importance of understanding, 427

investigating, 385387

JSON delivery process, 382

managing multiple, 422423, 426

simplifying with anonymous functions, 383

text delivery process, 384

waiting for results of, 424425, 426

properties

attributes vs., 60

explanation of, 300

object, 5051, 300, 316317

property accessors, 300304

explanation of, 300, 305, 319

investigation of, 301303

property identifiers, 303

propertyName variable, 304

proportional fonts, 36

prototypes

HTML, 277278

JavaScript, 279280

style sheet, 278279

pseudocode, 249

px unit, 78, 88, 90

Q

query strings, 397398, 404, 406

quote character, double (") and single ('), 119, 141, 143

R

random artwork, 417418

random function, 116, 117, 118

random numbers, 116118, 137139, 222226, 469

Raspberry Pi computers, xviii

real numbers

floating-point numbers and, 114116

whole numbers vs., 112113, 141, 142

recursion, 212

reduce method, 378, 402

refDemo variable, 290291

references

as arguments, 219220

array of, 372

game, 440

object, 49, 60, 290291, 299, 317

property accessors and, 319

stored in JSON strings, 299

relational operators, 152

removeChild method, 201, 204

removeItem function, 295

repeating code, 343

repositories, 1719

requestAnimationFrame method, 427, 429

requests, HTTP, 406

require function, 389, 401, 403

resetFind function, 314

resource information, xix

responses

contents of, 404

JavaScript commands and, 1012

requests vs., 406

result variable, 125

return keyword, 222

rgb function, 418

ride selector program, 161172

code added to, 165168

example of modifying, 178181

fixing faults in, 181183

switch construction in, 168170, 171

user interface for, 162, 163165

rollover style, 87

running games, 463464

S

salesItems element, 259260

sans-serif fonts, 68, 70

saving files, 20

scaffolding, 401

schemas, 304308

data storage created from, 309

designing for applications, 304305

HTML built from, 305308, 358359

objects built from, 308

scope of variables, 234235

scores

adding to games, 453454, 464

displaying in programs, 270

<script> element, 43, 58

scripting languages, 23, 102

searching. See finding

selectors

color highlighting using, 8687

style sheets using, 80

semicolon (;) character, 76

sendResponse function, 395

serif fonts, 68, 70

servers

code analysis of using, 390392

deploying Node.js, 401

process of building, 396

See also web servers

service function, 404

setAttribute method, 187

setInterval function, 74, 77, 88, 427

setItem method, 294, 295

setTimeout function, 52, 54, 57, 58

setup element, for loop, 191

shadow effect, 164165, 462

side effects, 136, 137

single quote (') character, 119, 141, 143

slide shows, 57

software. See programs

solving problems, 311

sort method, 371373, 374

sorting data, 371373, 376377, 402

sound

adding, 55, 140, 452453

playback control, 56, 140

source code, 13

source code highlighting, 24

source code management (SCM) software, 14

Source Control dialog, 18

<span> element, 8485, 88, 90

specifications, 134

spelling errors, 110

sprites, 436438, 443452, 456460

AI added to, 456457

cheese, 443444

cracker, 447452

friction added to, 458

killer tomato, 456458

physics of, 457458, 459

player, 445446

superclass for, 438

timed, 459460

square brackets [ ], 189, 288, 296, 319

src attribute, 39, 55, 57, 420

start and end tags, 32

start screen for games, 461462, 463

startsWith method, 312, 314, 317

statements

alert, 43

assignment, 105

blocks of, 160161, 193

for loop, 191

static class members, 352355, 357, 364

static keyword, 353, 354

status code, 404

Step control, 262263

stockItemCompare function, 372373

storage

arrays used for, 246248, 281283

class hierarchy and, 355

examples of breaking, 333334

local, 292295, 317

schema produced for, 309

storeContact function, 283, 292

storeData function, 308

stories, user, 336

stringify method, 296, 297, 317, 325, 329330

stringOrderCompare function, 373

strings of text. See text

stroke method, 412413

<strong> tag, 32

<style> tag, 80

style sheets

adding to documents, 80, 88

exploring the use of, 83

file created for, 8081, 88

prototype example, 278279

See also CSS

styles, 6491

cascading, 8586, 88

classes of, 82, 84

color, 6467

conflicting, 89

explanation of, 64

font, 6871

layouts vs., 81

managing, 86

margin, 7779

menu label, 269

overriding, 86

selectors for, 80, 87

style sheet for, 8081

text alignment, 71

subclasses

class hierarchy and, 345

extending classes and, 346

inheritance mechanism and, 343344

overriding methods in, 350352, 364

template for, 438

subscript, 246, 271

super keyword, 348, 352, 364

Super Search feature, 310315

code analysis of, 314315

problem solving for, 311

solutions for creating, 312314

superclasses

class hierarchy and, 345

game sprites and, 438

inheritance mechanism and, 343344

super keyword and, 348, 352

switch construction, 168171

explanation of using, 168170

missing breaks in, 171

path for controlling, 394

symbols, HTML display of, 3233, 58

synchronized actions, 380

T

TCP/IP protocol, 29

temperature conversion program, 130131

template, subclass, 438

test element, for loop, 191

testing

error, 110, 126

Node.js, 388

text

aligning, 71, 88

alternative, 39

arrays of, 265

combining numbers and, 120121

converting into numbers, 122123

delimiters for, 119

displaying, 4950, 462

emphasizing in HTML, 30

encoding with JSON, 295299

escape sequences for, 120

fonts selected for, 6871

getting from networks, 384

heading creation, 35

indicating with quotes, 10

margins around, 7779

paragraph layout, 34

preformatted, 3536, 59

as property accessors, 300304

shadow effect, 164165, 462

styling, 64, 71

text method, 384

textarea element, 278, 318

textContent property, 49, 5051

Theme Park Ride Selector. See ride selector program

then method, 381, 382, 384, 386, 403, 405406

this keyword, 340, 341, 364, 365, 376, 440, 442443

threads, 426

throw statement, 329

ticking clock program, 7277

code analysis, 75

creating, 7475

time display, 7273

timed sprites, 459460

timeString variable, 73

Tiny Contacts application. See contacts app

toFixed method, 130

Torvalds, Linus, 14, 24

total variable, 135, 136

totalizer program, 133137

trim function, 314, 317

true keyword, 146, 147148

try block, 326, 327, 328

try-catch construction, 326, 327, 328, 363, 386387

Twitter information, xix

two-dimensional arrays, 272

type attribute, 44

type property, 356

U

<ul> element, 164

undefined value, 106, 107, 141, 142

unordered lists, 188

update element, for loop, 191

update method, 434, 438, 451, 453, 460, 464

URLs (uniform resource locators)

parse method and, 395396, 397

query strings added to, 397398, 406

structure of, 2829, 59, 393

user interface

designing for customers, 162, 252254

examples of building, 163165, 252264, 357359

improving for contacts app, 309316

input paragraph creation, 254257

users

reading input from, 4445

receiving ideas from, 310, 316

written stories for, 336

V

validator site, 38, 327

value attribute, 44

values

Boolean, 146149, 173, 174

floating-point, 114115

functions returning, 222226

NaN, 11, 125, 141, 142, 148, 230, 231

parameters as, 217

query, 397

undefined, 106, 107, 141, 142

var keyword, 48, 72, 7576, 205, 235, 238

variables

control, 191

creating, 48, 72, 7576, 193, 236, 239

function of, 46, 105, 141

global, 134136, 142, 143, 235, 417

local, 135, 233236

scope of, 234235

working with, 106108

video walkthroughs, xviii

Visual Studio Code program, 13, 25

App Service Extension, 401

cloning repositories with, 1819

color styles added in, 65

editing files with, 19, 2022

finding files in, 21

font selector in, 69

installing, 1516

keywords in, 24

Node.js test in, 388

server run in, 390391

Visual Studio suite, 25

W

weather application, 379385

web browsers

badly formatted HTML in, 3738

JavaScript used in, 6

local storage managed by, 293, 318

web pages, 28

building from code, 196201

fetching with URLs, 2829

ideas for creating, 57

images added to, 3840

viewing code on, 69, 273

web servers

creating with Node.js, 389400

deploying Node.js, 401

JavaScript and, 23

web services, 398, 402

websites, 28

while loop, 201202, 204

whole numbers, 112113, 141, 142

window events, 429430

window object, 427, 429

World Wide Web (WWW)

HTML and, 28

Internet vs., 59

World Wide Web Consortium (W3C), 28

write method, 392

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

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