Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
js-objects-this_notes.pdf

README.md

LESSON: js-objects-this


2018-06-08

Tags: javascript, objects

OBJECTIVES

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

VOCABULARY

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

NOTES

  • 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

EXAMPLES