JavaScript Methods Worksheet

Question 1

How is a method different from a regular function in JavaScript?

It is different because it's inside a object.

Question 2

Why would we want to add methods to an object?

We would want to add methods to objects so they can be more useful and have a behavior.

Question 3

How can we access the property of an object from inside the body of a method of that object?

We would need to use the "this." operator.

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.