+ 1
what are differences between javascript object and object mathod?
2 ответов
+ 3
Object is a member of a class. An object method is a function used on an object.
0
Objects are a collection of properties and methods. Properties are key/value pairs, the value can be any primitive type(string, number, Boolean, null, undefined) or any object(arrays, functions, objects). If the properties value is a function we call it a method.
It works like this:
obj {
prop: "string";
meth: function(x) {
console.log(x);
};
}
obj.meth("rtfm!");