An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
April 5th, 2022
inside JavaScript,
*function *
function test() {}
also function can be value. That is, the function for the object's property is called method
objectA = {
B : function() {}
}
Method is a function for the object's property
Function is a function itself.
Function includes method.
Function is independent from object while a method is not.
Method can access the data inside the class/object
Property and Method
Object is a case made of properties
property is made of key-value pair
if value is function, we call that as method.
key is an identifier for identifying a property
const person = {
name = 'hyunjin',
say = function (){console.log('hi')}
}
name = property, say = method
the main who practice method is the object
the main who practice function is the function itself.
Original Link: https://dev.to/hyunjin/april-5th-2022-55hf
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To