Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (26 sloc) 1.62 KB

LESSON: js-objects-this


Tags: javascript, objects


  • Contrast the definitions of "property", "attribute", and "method"
  • Access properties within a method of the same object using this.


Property: keys within an object

Attribute: a property that holds a value

Method: a property that points to a function (behavior of an object)

this: used within an object. It references an object’s own property. References the containing object. All other uses of this are out of scope at this time Entity Relationship Diagram (ERD): a way to diagram an object that you will use in your program. Shows relationships between objects (entities)

  • A box with the entity name at the top, and the properties underneath

  • Can have the datatypes next to each property

  • Relationships can be a single line to other entities

  • useful to communicate with other stakeholders, like project managers and other developers


  • We cannot know what “this” is until the code runs
  • Think of methods as behavior of an object
  • Both methods and attributes are properties of an object
  • Another word for property is key
  • Another word for object is key / value pair, associative array, dictionary, or hash. In javascript, we usually say object, but other languages may prefer something else.
  • One way to break up complexity of a problem (creating an abstraction or solving a real-world problem) is to use multiple objects
  • Objects can have other objects as properties, or even collections of other objects