JETZT ONLINE BESTELLEN
Add to Cart
JavaScript: The Good Parts

First Edition Mai 2008
ISBN 978-0-596-51774-8
170 Seiten
EUR24.50, EUR24.50


Weitere Informationen zu diesem Buch

Inhaltsverzeichnis | Index | Probekapitel | Kolophon |


Index

	
[ Symbols ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ],

Symbols[ Top ]
-- decrement operator, 112, 118, 122
- negation operator, 122
-- operator, confusing pluses and minuses, 122
- subtraction operator, 122
!= operator, 109, 121
!== operator, 109
& and, 112
&& operator, 16
+ operator, 16, 104
      confusing pluses and minuses, 122
++ increment operator, 112, 118, 122
      confusing pluses and minuses, 122
+= operator, 15
<< left shift, 112
= operator, 15, 121
== operator, 106, 109, 121
=== operator, 15, 106, 109
>> signed right shift, 112
>>> unsigned right shift, 112
? ternary operator, 15
[ ] postfix subscript operator, 59
\ escape character, 8
^ xor, 112
| or, 112
|| operator, 17, 21
~ not, 112
/ operator, 16
/* */ form of block comments, 6
// comments, 6

A[ Top ]
adsafe option (JSLint), 117
Apply Invocation Pattern, 30
arguments, 31
arguments array, 106
array literals, 18
array.concat( ) method, 78
array.join( ) method, 78
array.pop( ) method, 79
Array.prototype, 62
array.push( ) method, 79
array.reverse( ) method, 79
array.shift( ) method, 79
array.slice( ) method, 80
array.sort( ) method, 80-82
array.splice( ) method, 82-83
array.unshift( ) method, 83
arrays, 58-64, 105
      appending new elements, 60
      arrays of arrays, 63
      cells of an empty matrix, 64
      confusion, 61
      delete operator, 60
      dimensions, 63
      elements of, 59
      enumeration, 60
      length property, 59
      literals, 58
      methods, 62
      Object.beget method, 63
      splice method, 60
      typeof operator, 61
      undefined value, 63
assignment, 121
assignment statement, 121
augmenting types, 32

B[ Top ]
beautiful features, 98-100
bitwise operators, 112, 122
bitwise option (JSLint), 117
block comments, 6, 96
block scope, 36, 99
blockless statements, 111
blocks, 10, 119
booleans, 20
braces, 96
break statement, 12, 14, 122
browser option (JSLint), 117
built-in value, 15

C[ Top ]
callbacks, 40
cap option (JSLint), 117
cascades, 42
case clause, 12
casting, 46
catch clause, 13
character type, 8
closure, 37-39
code quality tool (see JSLint)
comma operator, 119
comments, 6, 96
concatenation, 104
constructor functions, 123
      hazards, 49
      new prefix, forgetting to include, 49
Constructor Invocation Pattern, 29
constructor property, 47
constructors, 30
      defining, 47
continue statement, 111, 122
curly braces, 10
curry method, 43

D[ Top ]
debug option (JSLint), 117
deentityify method, 40
delegation, 23
delete operator, 24, 60
differential inheritance, 51
do statement, 10, 13
Document Object Model (DOM), 34
durable object, 55

E[ Top ]
ECMAScript Language Specification, 115
empty string, 12
enumeration, 24
eqeqeq option (JSLint), 117
equality operators, 109
escape character, 8
escape sequences, 9
eval function, 110, 122
      security problems, 139
evil option (JSLint), 117
exceptions, 32
executable statements, 10
expression statements, 120
expressions, 15-17
      ? ternary operator, 15
      built-in value, 15
      infix operator, 15
      invocation, 15
      literal value, 15
      operator precedence, 16
      preceded by prefix operator, 15
      refinement, 15
      refinement expression preceded by delete, 15
      variables, 15
      wrapped in parentheses, 15

F[ Top ]
factorial, 35, 45
Fibonacci numbers, 44
floating-point numbers, 104
for in statement, 13, 120
      objects, 24
for statements, 10, 12, 119
forin option (JSLint), 117
fragment option (JSLint), 117
Function constructor, 47, 111
function invocation, 95
Function Invocation Pattern, 28
function object, when object is created, 47
function statement versus function expression, 113
function.apply( ) method, 84
functional pattern (inheritance), 52-55
functions, 19, 26-45, 116
      arguments, 31
      augmenting types, 32
      callbacks, 40
      cascades, 42
      closure, 37-39
      curry method, 43
      exceptions, 32
      general pattern of a module, 41
      invocation, 27-30
            Apply Invocation Pattern, 30
            Constructor Invocation Pattern, 29
            Function Invocation Pattern, 28
            Method Invocation Pattern, 28
            new prefix, 29
      invocation operator, 28
      invoked with constructor invocation, 47
      literals, 27
      memoization, 44
      modules, 40-42
      objects, 26
      recursive, 34-36
            Document Object Model (DOM), 34
            Fibonacci numbers, 44
            tail recursion optimization, 35
            Towers of Hanoi puzzle, 34
      return statement, 31
      scope, 36
      that produce objects, 52
      var statements, 10

G[ Top ]
global declarations, 116
global object, 140
global variables, 25, 97, 101, 116
glovar option (JSLint), 117
good style, 95
grammar, 5-19
      expressions (see expressions)
      functions, 19
      literals, 17
      names, 6
      numbers, 7
            methods, 8
            negative, 8
      object literals, 17
      rules for interpreting diagrams, 5
      statements (see statements)
      strings, 8
            immutability, 9
            length property, 9
      whitespace, 5

H[ Top ]
hasOwnProperty method, 23, 107, 108
HTML
      <script> tags (JSON), 137
      innerHTML property, 140
      JSLint, 124

I[ Top ]
if statements, 10, 119
implied global, 102
Infinity, 7, 8, 15
inheritance, 3, 46-57
      differential, 51
      functional pattern, 52-55
      object specifiers, 50
      parts, 55-57
      prototypal pattern (inheritance), 50
      pseudoclassical pattern, 47-49, 54
inherits method, 49
innerHTML property, 140
instances, creating, 48
invocation operator, 17, 28
invocations, 95

J[ Top ]
JavaScript
      analyzing, 3-4
      standard, 4
      why use, 2
JavaScript Object Notation (see JSON)
JSLint, 4, 115-124
      -- decrement operator, 122
            confusing pluses and minuses, 122
      - operator, confusing pluses and minuses, 122
      != operator, 121
      + operator, confusing pluses and minuses, 122
      ++ increment operator, 122
            confusing pluses and minuses, 122
      = operator, 121
      == operator, 121
      assignment statement, 121
      bitwise operators, 122
      blocks, 119
      break statement, 122
      comma operator, 119
      constructor functions, 123
      continue statement, 122
      eval function, 122
      expression statements, 120
      for in statement, 120
      for statements, 119
      function report, 124
      functions, 116
      global declarations, 116
      global variables, 116
      HTML, 124
      if statements, 119
      JSON, 124
      labels, 122
      line breaking, 118
      members, 116
      new prefix, 123
      options, 117
      regular expressions, 123
      return statement, 122
      semicolons, 118
      switch statements, 120
      throw statement, 122
      var statements, 120
      variables, 116
      void, 123
      where to find, 115
      with statement, 121
JSON, 124
JSON (JavaScript Object Notation), 3, 136-140
      / character, 137
      array, 136
      eval function, 139
      HTML <script> tags, 137
      innerHTML property, 140
      JSLint, 124
      numbers, 137
      object, 136
      string, 137
      syntax, 136-139
      text example, 138
      using securely, 139
JSON.parse method, 139

K[ Top ]
K&R style, 96
Kleene, Stephen, 65

L[ Top ]
labeled statement, 14
labels, 122
language, structure (see grammar)
laxbreak option (JSLint), 117
length property (arrays), 59
line breaking, 118
line comments, 96
line-ending comments, 6
looping statement, 12, 14
loosely typed language, 46

M[ Top ]
Math object, 8
memoization, 44
message property, 14
Method Invocation Pattern, 28
method method, 49
methods, 78-93
      array.concat( ), 78
      array.join( ), 78
      array.pop( ), 79
      array.push( ), 79
      array.reverse( ), 79
      array.shift( ), 79
      array.slice( ), 80
      array.sort( ), 80-82
      array.splice( ), 82-83
      array.unshift ( ), 83
      arrays, 62
      function.apply( ), 84
      number.toExponential( ), 84
      number.toFixed( ), 85
      number.toPrecision( ), 85
      number.toString( ), 85
      object.hasOwnProperty( ), 86
      regexp.exec( ), 65, 86
      regexp.test( ), 65, 88
      string.charAt( ), 88
      string.charCodeAt( ), 88
      string.concat( ), 88
      String.fromCharCode( ), 93
      string.indexOf( ), 88
      string.lastIndexOf( ), 89
      string.localeCompare( ), 89
      string.match( ), 65, 89
      string.replace( ), 65, 90
      string.search( ), 65, 91
      string.slice( ), 91
      string.split( ), 65, 91
      string.substring( ), 92
      string.toLocaleLowerCase( ), 92
      string.toLocaleUpperCase( ), 92
      string.toLowerCase( ), 92
      string.toUpperCase( ), 93
      that work with regular expressions, 65
modules, 40-42
      general pattern, 41
multiple statements, 95
my object, 53

N[ Top ]
name property, 14
names, 6
NaN (not a number), 7, 8, 12, 15, 105
negative numbers, 8
new operator, 15, 47, 114, 123
      forgetting to include, 49
      functions, 29
newline, 73
nomen option (JSLint), 117
null, 11, 15, 20, 106
number literal, 8
number.toExponential( ) method, 84
number.toFixed( ) method, 85
number.toPrecision( ) method, 85
number.toString( ) method, 85
numbers, 7, 20
      methods, 8
      negative, 8
numbers object, 59

O[ Top ]
object literals, 17, 59
object specifiers, 50
Object.beget method, 53, 63
object.hasOwnProperty( ) method, 86
Object.prototype, 62
objects, 20-25, 107
      || operator, 21
      creating new, 22
      defined, 20
      delegation, 23
      delete operator, 24
      durable, 55
      enumeration, 24
      for in statement, 24
      functions, 26
      global variables, 25
      hasOwnProperty method, 23
      literals, 20
      properties, 21
      property on prototype chain, 23
      prototype, 22
            link, 23
      reference, 22
      reflection, 23
      retrieving values, 21
      undefined, 21, 23
      updating values, 22
on option (JSLint), 117
operator precedence, 16

P[ Top ]
parseInt function, 104
passfail option (JSLint), 117
pi as simple constant, 99
plusplus option (JSLint), 117
Pratt, Vaughn, 98
private methods, 53
privileged methods, 53
problematic features of JavaScript, 101-114
      + operator, 104
      arrays, 105
      bitwise operators, 112
      blockless statements, 111
      continue statement, 111
      equality operators, 109
      eval function, 110
      falsy values, 106
      floating-point numbers, 104
      function statement versus function expression, 113
      global variables, 101
      hasOwnProperty method, 107
      increment and decrement operators, 112
      NaN (not a number), 105
      new operator, 114
      objects, 107
      parseInt function, 104
      reserved words, 103
      scope, 102
      semicolons, 102
      single statement form, 111
      string argument form, 111
      switch statement, 111
      typed wrappers, 114
      typeof operator, 103
      Unicode, 103
      void, 114
      with statement, 110
prototypal inheritance, 3
prototypal inheritance language, 29
prototypal pattern, 50
prototype property, 47
prototypes of basic types, 33
pseudoclass, creating, 48
pseudoclassical pattern (inheritance), 47-49, 54
punctuation characters or operators, 118

R[ Top ]
railroad diagrams, 67
recursion, 34-36
      Document Object Model (DOM), 34
      Fibonacci numbers, 44
      tail recursion optimization, 35
      Towers of Hanoi puzzle, 34
reflection, 23
RegExp objects, properties, 72
regexp.exec( ) method, 65, 86
regexp.test( ) method, 65, 88
regular expressions, 65-77, 123
      $ character, 69
      (...), 68
      (?! prefix, 75
      (?: prefix, 75
      (?:...)?, 70
      (?= prefix, 75
      ? character, 67
      \1 character, 74
      \b character, 73, 74
      \d, 70
      \D character, 73
      \d character, 73
      \f character, 73
      \n character, 73
      \r character, 73
      \S character, 73
      \s character, 73
      \t character, 73
      \u character, 73
      \W character, 73
      \w character, 73
      ^ character, 67, 69
      / character, 68
      backslash character, 73-74
      capturing group, 68, 74
      carriage return character, 73
      construction, 70-72
      elements, 72-77
            regexp choice, 72
            regexp class, 75
            regexp class escape, 76
            regexp escape, 73-74
            regexp factor, 73, 76
            regexp group, 74
            regexp quantifier, 76
            regexp sequence, 72
      flags, 71
      formfeed character, 73
      matching digits, 70
      matching URLs, 66-70
      methods that work with, 65
      negative lookahead group, 75
      newline character, 73
      noncapturing group, 67, 75
      optional group, 68
      optional noncapturing group, 70
      positive lookahead group, 75
      railroad diagrams, 67
      repeat zero or one time, 68
      simple letter class, 74
      sloppy, 68
      tab character, 73
      Unicode characters, 73
reserved words, 7, 103
return statement, 14, 31, 122
rhino option (JSLint), 117

S[ Top ]
says method, 53
scope, 10, 36, 102
semicolons, 102, 118
seqer object, 42
setInterval function, 111
setTimeout function, 111
Simplified JavaScript, 98
single statement form, 111
spec object, 52, 53
splice method (arrays), 60
statements, 10-15
      blocks, 10
      break, 12, 14
      case clause, 12
      catch clause, 13
      do, 10, 13
      executable, 10
      execution order, 10
      for, 10, 12
      for in, 13
      if, 10
      labeled, 14
      loop, 14
      looping, 12
      return, 14
      switch, 10, 12, 14
      then block, 10
      throw, 14
      try, 13
      var, functions, 10
      while, 10, 12
string argument form, 111
string literal, 8
String, augmenting with deentityify method, 40
string.charAt( ) method, 88
string.charCodeAt( ) method, 88
string.concat( ) method, 88
String.fromCharCode( ) method, 93
string.indexOf( ) method, 88
string.lastIndexOf( ) method, 89
string.localeCompare( ) method, 89
string.match( ) method, 65, 89
string.replace( ) method, 65, 90
string.search( ) method, 65, 91
string.slice( ) method, 91
string.split( ) method, 65, 91
string.substring( ) method, 92
string.toLocaleLowerCase( ) method, 92
string.toLocaleUpperCase( ) method, 92
string.toLowerCase( ) method, 92
string.toUpperCase( ) method, 93
strings, 8, 20
      empty, 12
      immutability, 9
      length property, 9
structure of language (see grammar)
structured statements, 95
style, 94-97
      block comments, 96
      braces, 96
      comments, 96
      global variables, 97
      good, 95
      invocations, 95
      K&R, 96
      line comments, 96
      multiple statements, 95
      structured statements, 95
      switch cases, 97
super methods, 49
superior method, 54
switch statement, 10, 12, 14, 97, 111, 120
syntax checker (see JSLint)
syntax diagrams, 125-135

T[ Top ]
tail recursion optimization, 35
testing environment, 4
then block, 10
this keyword, 49
Thompson, Ken, 65
throw statement, 14, 122
Top Down Operator Precedence parser, 98
Towers of Hanoi puzzle, 34
trim method, 33
try statement, 13
typed wrappers, 114
TypeError exception, 21
typeof operator, 16, 61, 103, 106
types, 20
      prototypes of, 33

U[ Top ]
undef option (JSLint), 117
undefined, 7, 12, 15, 20, 21, 23, 28, 31, 63, 106
Unicode, 103

V[ Top ]
var statements, 120
      functions, 10
variables, 15, 116
verifier (see JSLint)
void operator, 114, 123

W[ Top ]
while statement, 10, 12
white option (JSLint), 117
whitespace, 5
widget option (JSLint), 117
Wilson, Greg, 98
with statement, 110, 121
wrappers, typed, 114

	

Zurück zu JavaScript: The Good Parts


Themen

Buchreihen

Special Interest

International Sites

O'Reilly China O'Reilly USA O'Reilly Japan O'Reilly Taiwan