A method is a function that belongs to an object.
For example, parseInt
is a standalone function – not a method:
const numberAsString = '123';
const parsedNumber = parseInt(123);
console.log(parsedNumber); // 123
While, getFullYear
is a function, that belongs to the Date
object. It's not standalone, since it is tied to a particular Date
object:
const date = new Date(2022, 8, 7);
const year = date.getFullYear();
console.log(year); // 2022