Title:
JavaScript Methods Worksheet
Updated:
November 10, 2023
Task/Activity:
- Questions
- Coding Problems
- How is a method different from a regular function in JavaScript?
A method is different because it is part of an object, and in order to use that method, you must use a declared instant of that object.
- Why would we want to add methods to an object?
So that we save time with typing code and keep relevant methods with the appropriate objects.
- How can we access the property of an object from inside the body of a method of that object?
Using the 'this' command.
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.