17.11.2015 Views

JavaScript_Succinctly

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

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

5<br />

Deleting object properties .......................................................................................... 51<br />

How references to object properties are resolved ..................................................... 51<br />

Using hasOwnProperty to verify that an object property is not from the prototype<br />

chain .......................................................................................................................... 54<br />

Checking if an object contains a given property using the in operator ...................... 55<br />

Enumerate (loop over) an object’s properties using the for in loop ........................ 55<br />

Host objects and native objects ................................................................................. 56<br />

Enhancing and extending objects with Underscore.js ............................................... 58<br />

Chapter 3: String() .................................................................................................... 61<br />

Conceptual overview of using the String() object ................................................... 61<br />

String() parameters ................................................................................................ 61<br />

String() properties and methods ............................................................................ 62<br />

String object instance properties and methods .......................................................... 62<br />

Chapter 4: Number() .................................................................................................... 64<br />

Conceptual overview of using the Number() object ................................................... 64<br />

Integers and floating-point numbers .......................................................................... 64<br />

Number() parameters ................................................................................................ 65<br />

Number() properties .................................................................................................. 65<br />

Number object instance properties and methods ...................................................... 66<br />

Chapter 5: Boolean() .................................................................................................. 67<br />

Conceptual overview of using the Boolean() object ................................................. 67<br />

Boolean() parameters .............................................................................................. 67<br />

Boolean() properties and methods .......................................................................... 68<br />

Boolean object instance properties and methods ...................................................... 68<br />

Non-primitive false Boolean objects convert to true ................................................... 68<br />

Certain things are false, everything else is true ......................................................... 69<br />

Chapter 6: Working with Primitive String, Number, and Boolean Values .............. 71<br />

Primitive/literal values are converted to objects when properties are accessed ........ 71<br />

You should typically use primitive string, number, and Boolean values ..................... 72<br />

Chapter 7: Null ............................................................................................................. 74<br />

Conceptual overview of using the null value............................................................ 74<br />

typeof returns null values as "object" ..................................................................... 74<br />

Chapter 8: Undefined .................................................................................................. 76<br />

Conceptual overview of the undefined value ........................................................... 76<br />

<strong>JavaScript</strong> ECMA-262 Edition 3 (and later) declares the undefined variable in the<br />

global scope .............................................................................................................. 76<br />

Chapter 9: The Head/Global Object ........................................................................... 78<br />

Conceptual overview of the head object .................................................................... 78<br />

Global functions contained within the head object ..................................................... 79<br />

The head object vs. global properties and global variables ....................................... 79<br />

Referring to the head object ...................................................................................... 80<br />

The head object is implied and typically not referenced explicitly .............................. 81<br />

Chapter 10: Object() .................................................................................................. 83<br />

Conceptual overview of using Object() objects ....................................................... 83<br />

Object() parameters ................................................................................................ 84<br />

Object() properties and methods ............................................................................ 85

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

Saved successfully!

Ooh no, something went wrong!