If I have the following object literal, I understand that val and prop are properties of the obj object.
const obj = {
val: 7,
prop: function() {
alert("prop " + this.val);
},
met() {
alert("met " + this.val);
}
};
obj.prop();
obj.met();
Property prop holds a reference to an anonymous function. Such a property is also referred to as a method.
In Visual Studio IntelliSense:
propis referred to as property,metis referred to as method.
But
- What is
met? - How does it differ from
prop? - When to use
propsyntax and whenmet?