Question: what is the difference between a function and a method in javascript?
Answer: A function is a piece of code that is called by name. It can be passed data to operate on and can optionally return data. All data that is passed to a function is explicitly passed. A method is a piece of code that is called by a name that is associated with an object.