Contact us to obtain full access!

Including...

Self-Grading Assessments

Project-Based Learning

Attendance Tracking

Student Data & Reporting

Professional Development

Web Development Foundations

4.3.1 Objects and Methods

In this section, students learn about objects. They will also be learning about object methods and properties.

Contact us to get the full experience and try out our LMS with Self Grading Quizzes, Gradebook, Attendance Tracking, Student Reporting, Discussion Board Features and more!

Contact Us

Objects

  • Objects are variables that can contain many values. These values are either properties or methods.
  • The properties of an object are written as key:value pairs. The key is what we use to reference this data like we use the index number to reference values inside of an array.
Code snippet image from course
  • Methods are functions that belong to an object. In the example below, sayHello is a method.
Code snippet image from course

Accessing Properties of an Object

  • To access a property that belongs to an object, we append a dot (.) and the property key to the object name.
Code snippet image from course

The “This” Keyword

  • Inside a method within an object, the keyword “this” is used to refer to the object that the method belongs to.
  • We can access properties of the owner object by writing this.someProperty.
Code snippet image from course

Javascript

JavaScript Objects: A W3 Schools page talking about objects, properties, methods, and the “this” keyword.

Object: a variable that can hold many different values as well as functions.

Property: a value that belongs to an object. It has a key that is used to reference it.

Method: a function that belongs to an object.

this: a keyword used to refer to the object in which the word is used.