Example: air traffic controller

INDEX [nostarch.com]

IN D E XSymbols&&operator, 17, 20, 96*operator, 13, 18, 156*=operator, 34{}(block), 31, 44, 85{}(object), 63, 113-operator, 14, 15, 18-=operator, 34=operator, 25, 64, 168, 170, 197==operator, 16, 19, 66, 79===operator, 19, 79, 410/operator, 14/=operator, 34>operator, 16>=operator, 16<operator, 16<=operator, 16 operator, 34%operator, 14, 34, 286, 408, 417, 419+operator, 13, 15, 18, 156, 403++operator, 34+=operator, 34?:operator, 17, 20[](array), 60[](subscript), 61||operator, 17, 19, 51, 96, 123,326, 408200 (HTTP status code), 300, 354204 (HTTP status code), 3602d (canvas context), 277400 (HTTP status code), 424404 (HTTP status code), 300, 359,374, 376405 (HTTP status code), 358406 (HTTP status code), 420500 (HTTP status code), 359, 363Aa(HTML tag), 210, 224, 226, 318 Abelson, Hal, 190absolute path, 424absolute positioning, 229, 233, 241,245, 250abstract syntax tree,seesyntax treeabstraction, 82, 84, 85, 91, 191,208, 218acceleration, 268 Acceptheader, 312, 363, 420access control, 127, 151, 178, 371 Access-Control-Allow-Originheader, 305actionTypesobject, 130activeElementproperty, 317actor, 256, 261, 266 267, 291actorAtmethod, 266addEntryfunction, 66addEventListenermethod, 236, 270, 356addition, 13, 117address, 299address bar, 209, 299, 301adoption, 153age difference (exercise)

animation avoiding stutter, 230 cat in ellipse, 230 collision detection, 265 frames for, 285–286, 290–291 game, 264, 266–269, 271 getting elements by tag name, 233

Tags:

  Index

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of INDEX [nostarch.com]

1 IN D E XSymbols&&operator, 17, 20, 96*operator, 13, 18, 156*=operator, 34{}(block), 31, 44, 85{}(object), 63, 113-operator, 14, 15, 18-=operator, 34=operator, 25, 64, 168, 170, 197==operator, 16, 19, 66, 79===operator, 19, 79, 410/operator, 14/=operator, 34>operator, 16>=operator, 16<operator, 16<=operator, 16 operator, 34%operator, 14, 34, 286, 408, 417, 419+operator, 13, 15, 18, 156, 403++operator, 34+=operator, 34?:operator, 17, 20[](array), 60[](subscript), 61||operator, 17, 19, 51, 96, 123,326, 408200 (HTTP status code), 300, 354204 (HTTP status code), 3602d (canvas context), 277400 (HTTP status code), 424404 (HTTP status code), 300, 359,374, 376405 (HTTP status code), 358406 (HTTP status code), 420500 (HTTP status code), 359, 363Aa(HTML tag), 210, 224, 226, 318 Abelson, Hal, 190absolute path, 424absolute positioning, 229, 233, 241,245, 250abstract syntax tree,seesyntax treeabstraction, 82, 84, 85, 91, 191,208, 218acceleration, 268 Acceptheader, 312, 363, 420access control, 127, 151, 178, 371 Access-Control-Allow-Originheader, 305actionTypesobject, 130activeElementproperty, 317actor, 256, 261, 266 267, 291actorAtmethod, 266addEntryfunction, 66addEventListenermethod, 236, 270, 356addition, 13, 117address, 299address bar, 209, 299, 301adoption, 153age difference (exercise)

2 , 95, 411alertfunction, 27, 47, 211algorithm, 423algorithmic optimization, 398, 405alignment, 114allfunction, 313, 421alpha, 343alphanumeric character, 155altattribute, 221 ALTkey, 240altKeyproperty, 240ambiguity, 202 AMD, 183, 185 American English, 156ampersand character, 211, 301analysis, 139, 143ancestor element, 262ancestry example, 87 90, 92 95 ANCESTRY_FILE data set, 88angle, 231, 282 283, 341, 419angle brackets, 210animatemethod, 266 Eloquent JavaScript, 2nd Edition 2014 Marijn Haverbekeanimationavoidingstutter, 230cat in ellipse, 230collision detection, 265frames for, 285 286, 290 291game, 264, 266 269, 271getting elements by tag name, 233mouse trail, 250off-screen, 244scheduling, 230simple, 129, 134sprite, 293stopping, 271 SVG vs. canvas, 295anonymousfunction, 178appendChildmethod, 220, 260, 416 Apple, 213application (of functions),seefunctionapplicationapplyme thod, 86, 101approximation, 119arc, 281 283arcmethod, 282, 420arcTomethod, 281, 282area, 341argument, 27, 47, 51, 163, 192argumentsobject, 74, 86, 409argvproperty, 350arithmetic, 13, 18, 198 Armstrong, Joe, 98arraycreation, 60, 91, 121, 409defined, 64 Egg support, 202every method, 96filtering, 88flattening, 95forEachmethod, 84as grid, 120, 343higher-order functions and, 87indexing, 61, 409, 417lengthproperty, 62, 121mapmethod, 89methods, 72objects and, 78random element from, 123reversemethod, 78searching, 69, 72slicemethod, 73somemethod, 96splicemethod, 377as table, 68traversal, 83 Arrayconstructor, 121 Arrayprototype, 102, 104array-like object, 86, 186, 318, 323, 353arrow function, 125artificial intelligence, 119, 130, 135,201, 412artificial life, 119, 254, 328artificial stupidity (exercise)

3 , 135, 412 ASCII art, 352assertfunction, 149assertion, 149, 150assignment, 25, 34, 168, 170, 202, 416assumption, 148, 150asterisk, 13, 156asynchronous I/O, 183, 304, 348asynchronous programmingcallbacks, 304, 308code execution path and, 185defined, 272dependencies and, 183error handling, 307functions and, 352 Node and, 348overview, 348, 349parallelism and, 349promise interface, 310reading files, 323writable streams, 356attack, 305attribute, 210, 222, 332, 421, 422 Aurelius, Marcus, 234authorization, 371autocompletion (exercise), 328, 421autofocusattribute, 317automatic semicolon insertion, 24avatar, 254averagefunction, 90, 95, 96, 411axis, 268, 277, 287 288 BBabbage, Charles, 58background, 254, 260 261, 265, 291background (CSS), 250, 254, 261backgroundReadFilefunction, 184, 306430 INDEXE loquent JavaScript, 2nd Edition 2014 Marijn Haverbekebackslashcharacterboundary markers, 166escaping in regular expressions,154, 166escaping in strings, 14paths using, 364backtracking, 162, 165backward compatibility, 177ball, 297, 420 Banks, Iain, 252bean counting (exercise), 56, 409beforeunloadevent, 246behavior, 122, 129, 172, 201, 412 413benchmark, 225, 389, 395 Berners-Lee, Tim, 298best practices, 3bezierCurvemethod, 281binary data, 3, 353binary number, 11, 12, 68, 142,162, 322binary operator, 13, 15, 23bindmethod, 94, 101, 125bit, 4, 12, 16, 68bitmap graphics, 284, 297 Blobtype, 324block, 31, 32, 42, 145, 146, 192block comment, 36, 165block element, 224, 226 227blocking, 183, 230, 246, 248, 304,348, 354blurevent, 245 246blurmethod, 317body(HTML tag), 210 211, 216body (HTTP)

4 , 301 303, 355, 360,361, 374bodyproperty, 216, 217, 219bold, 226book analogy, 175, 188 Book of Programming, The, 10, 346 Booleanconditional execution, 29conversion to, 19, 29, 32defined, 16 Egg support, 197immutable types, 65using with while loop, 31 Booleanfunction, 29border (CSS), 225, 226border-radius (CSS), 241bouncing, 122, 255, 257 258, 265,267, 297 BouncingCrittertype, 122boundary, 160, 161, 166, 170, 172,291, 414box, 151, 215, 254, 297, 420box shadow (CSS), 262br(HTML tag), 422braces,seecurly bracesbranching, 160, 162branching recursion, 51, 289breakkeyword, 33, 35breakpoint, 143 British English, 156browserbitmaps in, 297color field support, 336compatibility between, 213console output, 27dialog boxes in, 28doctype and, 211events in, 236global scope, 77graceful degradation, 387history of JavaScript, 6 JavaScript support, 2long polling, 369old, 213private namespace pattern, 180responsiveness, 390security, 212 213, 305, 364sessionStorage, 327 XMLHttpRequestand, 302 304browser wars, 213 Browserify, 183brush, 332, 336 337, 340bubbling,seeevent propagationbucket fill, 343, 423budget, 387 Buffertype, 353, 356bugbrowser history, 213decoupling and, 177defined, 81, 139lastIndexproperty and, 167regular expressions and, 166business software, 302button, 235, 301, 318, 328, 339 INDEX431 Eloquent JavaScript, 2nd Edition 2014 Marijn Haverbekebutton(HTMLtag), 212, 236, 241, 251,319, 325, 327byNameobject, 92, 95CC (programming language)

5 , 389cache, 182, 184, 415callmethod, 101, 105, 114, 126,131, 199call protocol, 396call stack, 46 48, 51, 145, 147, 149, 396callback functiondefined, 306error arguments, 307event handlers, 235promises and, 308readable streams, 355writable streams, 356calling (of functions),seefunctionapplicationcamel case, 36, 227cancelAnimationFramefunction, 248canvasarcTomethod, 282bezierCurvemethod, 281circles, 281clearRectmethod, 285color picker exercise, 342context, 277, 339cross-domain requests, 338defined, 275drawGraphfunction, 393drawing text in, 284filling and stroking, 278graphics options in browser, 295loading pixel data into, 285path, 278performance and, 295size, 277, 278strokeTomethod, 279toDataURLmethod, 337transformations in, 286 288canvas(HTML tag), 277, 332canvasproperty, 333 CanvasDisplaytype, 290, 291, 293capitalizationwith censored keyboard, 417in header names, 304in property names, 227in variable names, 35 36capture group, 158, 159, 163 164, 373career, 253caret character, 155, 160, 170carnivore, 136carriage return, 169cascading, 228 Cascading Style Sheets,seeCSScase conversion, 62casekeyword, 35case-sensitivity, 157, 304, 414casual computing, 2cat s hat (exercise), 233catchkeyword, 145, 147 148, 150, 413catchmethod, 310CD, 11celery, 367cell, 328censored keyboard (exercise), 250, 417center, 263centering, 230century, 96, 411certificate, 311chaining, 309, 362changeevent, 317, 320, 327, 339, 425chapter, 175character, 14, 240, 320character category, 171character encoding, 353charAtmethod, 56, 74charCodeproperty, 240, 417charCodeAtmethod, 240, 403chat, 208checkbox, 316, 321, 328, 422checkedattribute, 316, 321chess board (exercise)

6 , 38, 408child node, 217, 218, 220, 243childNodesproperty, 218, 221, 418choice, 160 Chrome, 213circle, 231, 281 282, 341circle(SVG tag), 276circular dependency, 188, 415circus, 72classattribute, 220, 224, 228, 260, 262,333, 382classNameproperty, 224cleaning up, 146, 264432 INDEXE loquent JavaScript, 2nd Edition 2014 Marijn Haverbekeclearing, 223, 275, 285, 288 289,291 292, 420clearIntervalfunction, 248clearRectmethod, 285, 420clearTimeoutfunction, 248cleverness, 186clickevent, 236, 238, 241, 421, 425client, 208, 310, 355, 368, 379clientHeightproperty, 225clientWidthproperty, 225clientXproperty, 242, 334clientYproperty, 242, 334clipboard, 212, 250clipping, 291cloneNodemethod, 383cloning, 383closePathmethod, 279closing tag, 210, 212closure, 48, 85, 202, 324, 397, 416 418code, 7, 23, 43, 165, 254code golf, 172code structure, 32, 41, 115, 175coin, 254, 255, 266 270, 294 Coin type, 258, 267collaboration, 207collection, 5, 60, 62, 64, 78, 117, 412collision detection, 264 269, 420colon character, 17, 35, 63, 226color, 276, 278, 292, 332, 336, 342color (CSS), 226, 227color picker, 336color picker (exercise)

7 , 342, 423colWidthsfunction, 108comma character, 192command key, 240command line, 347, 349 351comment, 36, 165, 202, 217, 368, 370,384, 416comment field reset (exercise),386, 425 COMMENT_NODE code, 217 CommonJS, 180 182, 188, 350, 351communication, 208, 310community, 348comparisonof colors, 423creating Boolean values, 16of DOM nodes, 425of NaN, 17of numbers, 16, 28of objects, 66of strings, 16for switch statement, 35of undefined values, 19compass direction, 122, 129compatibility, 6, 207, 213, 303, 336compilation, 200, 389 390, 402, 416completion, 303, 328complexity, 3, 81, 91, 99, 186, 399composability, 5, 90, 91, 186compositing, 336composition, 115computedproperty, 61computer, 1, 3concatmethod, 73, 95, 112, 417, 426concatenation, 15, 73, 112, 417,423, 424concurrency, 246conditional execution, 17, 29, 35, 38,196, 387conditional operator, 17, 20configuration, 169confirmfunction, 28 Confucius, 2connection, 208, 299, 304, 306,311, 369consistency, 36, 207, , 15, 27, 46, 75, 143constant, 76, 269constructorError, 146inheritance using, 114instanceofoperator and, 115overview, 103prototypeproperty for, 103using without new keyword.

8 141content negotiation (exercise), 312,363, 420, 424 Content-Lengthheader, 300 Content-Typeheader, 300, 354, 358, 364context, 277, 333 334, 339context menu, 239context parameter, 125, 126continuekeyword, 34control flow, 29, 31 33, 46, 85,145, 310control key, 240control point, 280, 281 INDEX433 Eloquent JavaScript, 2nd Edition 2014 Marijn Haverbekecontrolsobject, 333, 336convention, 36, 186 Conway sGame of Life, 328coordinates, 120, 241, 260, 277, 278,334, 422 423copying, 383copy-paste programming, 53, 176correlation, 67 69, 71cosine, 76, 231counter variable, 31, 33, 231, 408, 409,417, 421crash, 147, 150, 361, 375, 386createElementmethod, 221, 332, 416createPaintfunction, 333createReadStreamfunction, 356, 359createServerfunction, 354, 356,372, 373createTextNodemethod, 221, 421createWriteStreamfunction, 356, 360crisp, 295critters, 119action handlers and, 131 133animating, 126 128behavior, 129 130predators of, 136 Crockford, Douglas, 206cross-domain request, 305, 338, 343cryptography, 311 CSS, 227.

9 244, 261 262, 264, 275, 333ctrlKeyproperty, 240curl program, 361curly braces, 31brace notation, 63for function body, 42for multiple loops, 408with parentheses, 84with pattern, 156 157cursor, 319 320curve, 280 281cycle, 217 DDark Blue (game), 254dash character, 14, 155, 227data, 2, 59data attribute, 222, 223, 251dataevent, 356data format, 87, 218, 305data loss, 386data set, 68, 87, 111data structure, 59 79in ancestor example, 92 93when building programminglanguage, 192lists, 78 79trees, 216 217using simple, 186in weresquirrel example, 60 61data URL, 337database, 303dataTablefunction, 112, 114date, 155, 156, 158 Dateconstructor, 158 159datefield, 336 Datetype, 177, , 159, 371, 404dblclickevent, 241debouncing, 248debuggerstatement, 143debuggingdefined, 140 Errorconstructor, 145 JavaScript weaknesses, 6overview, 139use strictand, 141using assertions, 150usingcatchkeyword, , 143decentralization, 207decimal number, 11, 142, 162declaration, 226decodeURIC omponentfunction, 301, 358,373, 424decoupling, 177deep comparison, 66, 79deep comparison (exercise)

10 , 79, 410default behavior, 226, 239, 417defaultkeyword, 35default value, 20, 93, 278, 326, 409defensive programming, 127, 128definefunction, 183 185definePropertyfunction, 106, 113, 411degree, 282, 287 DELETE method, 300 301, 357, 359,374, 384delete operator, 64denodeifyfunction, 361deoptimization, 397, 402434 INDEXE loquent JavaScript, 2nd Edition 2014 Marijn Haverbekedependence, 67dependency, 176 177, 180, 183 184,188, 352deserialization, 87developertools, 7, 27, 144, 147dialog box, 27, 28diamond, 296, 419digit, 11, 12, 142, 155 157, 173 Dijkstra, Edsger, 118dimensions, 117, 119, 225, 253, 255,265, 277, 408dinosaur, 201direct child node, 228directionsobject, 122, 129directory, 353 354, 357 359, 364, 425disabledattribute, 318discretization, 119, 254, 265, 267, 271dispatching, 35, 372display, 260, 290, 295display (CSS), 226, 251, 380distance, 394division, 14division by zero, 14 DNA, 92, 93doloop, 32doctype, 210 211document, 209, 215, 246, 275document format, 311, 312 Document Object Model,seeDOMdocumentation, 186, 347documentElementproperty, 216, 217, 304dollar sign, 25, 160, 163, 170 DOMaddEventListener, 236canvaselement, 275cloneNode, 383construction, 218, 220, 222, 332, 380creating structures in JavaScript, 380 CSS and, 275documentElement, 217events and, 241forms in, 315graphics in, 255object properties, 222overview, 216, 220selectors and, 229value property, 319domain, 209, 301, 305, 325, 338domain-specific language, 82, 142, 153,201, 229, 310, 380 DOMD isplaytype, 260, 290dot character,seeperiod characterdouble-click, 241double-quote character, 14, 173,192, 211download, 7, 177, 232, 361, 368, 386draggable bar example, 242dragging, 242drawGraphfunction, 393drawImagemethod, 285, 287, 290,292 293, 420drawingbuilding a program for, 331 344andcanvaselement, 275 297checkboxes.


Related search queries