Layer 1: Single ObjectsKinds of PropertiesObject LiteralsDot Operator (.): Accessing Properties via Fixed KeysGetting propertiesCalling methodsSetting propertiesDeleting propertiesThe return value of deleteUnusual Property KeysBracket Operator ([]): Accessing Properties via Computed KeysGetting properties via the bracket operatorCalling methods via the bracket operatorSetting properties via the bracket operatorDeleting properties via the bracket operatorConverting Any Value to an Objectthis as an Implicit Parameter of Functions and MethodsCalling Functions While Setting this: call(), apply(), and bind()Function.prototype.call(thisValue, arg1?, arg2?, ...)Function.prototype.apply(thisValue, argArray)Function.prototype.bind(thisValue, arg1?, ..., argN?)apply() for ConstructorsManually simulating an apply() for constructorsA library methodAn alternative approachPitfall: Losing this When Extracting a MethodHow to get a warningHow to properly extract a methodCallbacks and extracted methodsPitfall: Functions Inside Methods Shadow thisWorkaround 1: that = thisWorkaround 2: bind()Workaround 3: a thisValue for forEach()Layer 2: The Prototype Relationship Between ObjectsInheritanceOverridingSharing Data Between Objects via a PrototypeGetting and Setting the PrototypeCreating a new object with a given prototypeReading the prototype of an objectChecking whether one object a prototype of another oneFinding the object where a property is definedThe Special Property __proto__Setting and Deleting Affects Only Own PropertiesSetting a propertyDeleting an inherited propertyChanging properties anywhere in the prototype chainIteration and Detection of PropertiesListing Own Property KeysListing All Property KeysChecking Whether a Property ExistsExamplesThe effects of enumerabilityThe effects of inheritanceComputing the number of own properties of an objectBest Practices: Iterating over Own PropertiesAccessors (Getters and Setters)Defining Accessors via an Object LiteralDefining Accessors via Property DescriptorsAccessors and InheritanceProperty Attributes and Property DescriptorsProperty AttributesDefault valuesProperty DescriptorsGetting and Defining Properties via DescriptorsCopying an ObjectProperties: Definition Versus AssignmentInherited Read-Only Properties Can’t Be Assigned ToEnumerability: Best PracticesProtecting ObjectsPreventing ExtensionsSealingFreezingPitfall: Protection Is ShallowLayer 3: Constructors—Factories for InstancesThe new Operator Implemented in JavaScriptTerminology: The Two PrototypesThe constructor Property of InstancesUse cases for the constructor propertyBest practiceThe instanceof OperatorPitfall: objects that are not instances of ObjectPitfall: crossing realms (frames or windows)Tips for Implementing ConstructorsProtection against forgetting new: strict modeReturning arbitrary objects from a constructorData in Prototype PropertiesAvoid Prototype Properties with Initial Values for Instance PropertiesBest practice: don’t share default valuesCreating instance properties on demandAvoid Nonpolymorphic Prototype PropertiesPolymorphic Prototype PropertiesKeeping Data PrivatePrivate Data in the Environment of a Constructor (Crockford Privacy Pattern)Public propertiesPrivate valuesPrivileged methodsAn exampleThe pros and cons of the Crockford privacy patternPrivate Data in Properties with Marked KeysPrivate Data in Properties with Reified KeysKeeping Global Data Private via IIFEsAttaching private global data to a singleton objectKeeping global data private to all of a constructorAttaching global data to a methodLayer 4: Inheritance Between ConstructorsInheriting Instance PropertiesInheriting Prototype PropertiesEnsuring That instanceof WorksOverriding a MethodMaking a SupercallAvoiding Hardcoding the Name of the SuperconstructorExample: Constructor Inheritance in UseExample: The Inheritance Hierarchy of Built-in ConstructorsAntipattern: The Prototype Is an Instance of the SuperconstructorMethods of All ObjectsConversion to PrimitiveObject.prototype.toLocaleString()Prototypal Inheritance and PropertiesGeneric Methods: Borrowing Methods from PrototypesAccessing Object.prototype and Array.prototype via LiteralsExamples of Calling Methods GenericallyArray-Like Objects and Generic MethodsPatterns for working with array-like objectsA List of All Generic MethodsPitfalls: Using an Object as a MapPitfall 1: Inheritance Affects Reading PropertiesChecking whether a property existsCollecting property keysGetting a property valuePitfall 2: Overriding Affects Invoking MethodsPitfall 3: The Special Property __proto__The dict Pattern: Objects Without Prototypes Are Better MapsNormal objectsPrototype-less objectsRecommendationBest PracticesCheat Sheet: Working with Objects