Question: what is the difference between a method and a function in javascript?
Answer: In short: a method is a function that belongs to a class. In JavaScript, however, a method is a function that belongs to an object. Everything in JavaScript is an object; a function is an object; an Array is an object.