Skip to content

Instantly share code, notes, and snippets.

@natevenn
Created May 4, 2016 17:41
Show Gist options
  • Select an option

  • Save natevenn/e7a800de98c7465b8dcd0daf7d309367 to your computer and use it in GitHub Desktop.

Select an option

Save natevenn/e7a800de98c7465b8dcd0daf7d309367 to your computer and use it in GitHub Desktop.
Objects and inheritance
A JS property is an object with a key, value pair with maps from string to values.
three types of properties are named data properties, named accessor properties, and internal properties
Use 'this' in methods to refer to current object
use the dot operator to get the properites value (this.name) only fixed property keys
the 'delete' operator removes a property
the 'bracket' operator works with property expressions and returns the value
In JS you can convert any value into an object with 'object()'
Every obj can have another obj as its prototype. This describes the relationship between objs and prototypes
former obj inherits all the prototypes properties
Prototypes are great for sharing data b/w objects
Accessors are the getters and setters
can be defined as Obj literals or property descriptors
Property attributes are its data and metadata
attr keys are writen in double brackets
define a property using defineProperty() - creates a new or updates
assign via = - reassigns an existing property
Constructors are factories for instances
helpful when producing objs that are similar and want to share data
invoked using 'new'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment