From the course: JavaScript Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Practice: Build a new method - JavaScript Tutorial
From the course: JavaScript Essential Training
Practice: Build a new method
- Before we go any further, I want you to practice building methods. Now, as I've already pointed out we haven't covered functions yet so you may feel like you're in deep water here. So let me narrow this practice assignment down for you. In the practice files, there's an object with a bunch a different properties. Some of them are strings, some are numbers, some are Booleans. To practice creating and using methods, I want you to create new methods in this object, one to change each property. The important things to remember here are, one, we pass values to a function by placing them inside the parentheses. Two, from within an object method we refer to the current object as this. Number three, any property can hold any value. So once you can access a property from within a method you can set that property to any value you like.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Objects: A practical introduction4m 53s
-
(Locked)
JavaScript objects: The code version2m 57s
-
(Locked)
Object containers2m 22s
-
(Locked)
Object properties55s
-
(Locked)
Accessing objects2m 32s
-
(Locked)
Accessing object properties5m 35s
-
(Locked)
Practice: Build a new object1m 18s
-
(Locked)
Object methods6m 29s
-
(Locked)
Practice: Build a new method56s
-
(Locked)
Classes: Object blueprints6m 35s
-
(Locked)
Object constructors2m 21s
-
(Locked)
Practice: Build a new object with a constructor1m 13s
-
(Locked)
Global objects7m 47s
-
(Locked)
Challenge intro: Create a new object type2m 5s
-
(Locked)
Solution: Create a new object type3m 16s
-
-
-
-
-
-
-
-
-