With respect to JS, what\'s the difference between the two? I know methods are associated with objects, but am confused what\'s the purpose of functions? How does the syntax
There is a slight difference -
Method : Method is a function when object is associated with it.
var obj = {
name : "John snow",
work : function someFun(paramA, paramB) {
// some code..
}
Function : When no object is associated with it , it comes to function.
function fun(param1, param2){
// some code...
}