Method
noun
say it: “METH-ud” /ˈmɛθəd/
A function stored on an object or a class, which you call with a dot, like cart.addItem().
What is Method in JavaScript?
Method — A function that belongs to a class, called on an object with a dot.
const order = {
quantity: 2,
describe() {
return `${this.quantity} items`;
}
};
In a sentence
- “addSong is a method on the playlist, so I call it as playlist.addSong("Sunny Road").”
Level: Apprentice · More JavaScript terms at this level
Updated