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 functio…


This content originally appeared on DEV Community and was authored by Hyunjin Cho

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.


This content originally appeared on DEV Community and was authored by Hyunjin Cho


Print Share Comment Cite Upload Translate Updates
APA

Hyunjin Cho | Sciencx (2022-04-05T21:22:10+00:00) April 5th, 2022. Retrieved from https://www.scien.cx/2022/04/05/april-5th-2022/

MLA
" » April 5th, 2022." Hyunjin Cho | Sciencx - Tuesday April 5, 2022, https://www.scien.cx/2022/04/05/april-5th-2022/
HARVARD
Hyunjin Cho | Sciencx Tuesday April 5, 2022 » April 5th, 2022., viewed ,<https://www.scien.cx/2022/04/05/april-5th-2022/>
VANCOUVER
Hyunjin Cho | Sciencx - » April 5th, 2022. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/05/april-5th-2022/
CHICAGO
" » April 5th, 2022." Hyunjin Cho | Sciencx - Accessed . https://www.scien.cx/2022/04/05/april-5th-2022/
IEEE
" » April 5th, 2022." Hyunjin Cho | Sciencx [Online]. Available: https://www.scien.cx/2022/04/05/april-5th-2022/. [Accessed: ]
rf:citation
» April 5th, 2022 | Hyunjin Cho | Sciencx | https://www.scien.cx/2022/04/05/april-5th-2022/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.