JavaScript Methods Worksheet
Question 1
How is a method different from a regular function in JavaScript?
Methods are specifically meant to work with objects, and are often found as an object's children.
Question 2
Why would we want to add methods to an object?
Simply put, if objects and their properties represent what things are, then methods represent what they do.
Question 3
How can we access the property of an object from inside the body of a method of that object?
"this" must precede the property. For example, if "xyz" is the property, then you must use "this.xyz" within the method.
Coding Problems
Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.
Always test your work! Check the console log to make sure there are no errors.