23.04.2013 Views

javascript

javascript

javascript

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

closures, 217<br />

conditional advance loading, 185<br />

conditionally changing a function value<br />

while it’s running, 194<br />

curly braces and, 21, 217<br />

currying, 208<br />

definition of, 20<br />

eliminating global variables, 226<br />

exploring functions as values, 183<br />

expressing first-class functions with literals,<br />

183<br />

function declaration, 183<br />

function invocation, definition of, 97<br />

function keyword, 20<br />

function literals, creating, 19<br />

function scope, 183, 217<br />

Function.prototype.bind(), 208–209<br />

Function.prototype.constructor, 184<br />

Function.prototype.toString(), 184<br />

global abatement with modules, 226<br />

inheriting members from Object.prototype,<br />

184<br />

invoking a function by its name, 183<br />

isArray(), 201, 204–205<br />

lazy loading, 194<br />

memoization, 224<br />

methods, chaining, 212<br />

new ECMAScript 5 static methods, list of,<br />

185<br />

parameters, 20<br />

passing a configuration object rather than<br />

separate parameters, 222<br />

rankFlavor(), 21<br />

recursive functions, 198<br />

scope chain, 217<br />

testing for an array, 204<br />

this, 212<br />

toString(), 201–203<br />

traverseTree(), 200<br />

See also methods; recursion<br />

■ G<br />

getAttribute(), 437<br />

getComputedStyle(), 335–336, 362, 366, 370<br />

getCookie(), 401–403<br />

getData(), 425, 427–428, 430, 432, 436<br />

getElementById(), 277<br />

getElementsByClassName(), 360<br />

W3 online documentation for, 362<br />

getElementsByTagName(), 278, 359, 433<br />

getPropertyValue(), 309<br />

global abatement, 226<br />

global variables, eliminating, 226<br />

greater than (>) operator, 75<br />

greater than or equal to (>=) operator, 80<br />

green.css, 350<br />

grouping () operator, 70<br />

■ H<br />

HTMLDivElement, 257<br />

HTMLElement, 257, 281<br />

HTMLStyleElement, 282<br />

■ I<br />

identifiers, definition of, 6<br />

identity (===) operator, 69<br />

if statement<br />

?: operator, 105<br />

addToTally(), 98<br />

else clause, 100<br />

else if idiom, 103<br />

fridge code example, 102<br />

kmLeftToLive(), 98<br />

mayfly code example, 98<br />

returning undefined, 100<br />

syntax of, 98<br />

wrapping in curly braces, 101<br />

writing an if condition, 98<br />

See also conditional statements; looping<br />

statements<br />

@import, 322, 326–327, 340, 343<br />

in operator, 94<br />

increment (++) operator, 66<br />

index, 15<br />

indexOf(), 35, 401–402<br />

infinite loop, 116<br />

inheritance<br />

adding an empty chain link, 166<br />

apply(), 169<br />

■ INDEX<br />

469

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!