+ 2
What is the difference between method and function?
I wanna know from u learners and don't say both same coz I'll tell u after your all answers
4 ответов
+ 11
I only heard that:
C++ says use functions
Java says use methods
Both are same.
+ 10
In short, method is a function in a object... function is a function.
----------------------------------
Function:
function func () {
...
}
~~~~~~~~~~~~~~~~
Method:
var myObj = {
func: function () { ... }
}
( In Javascript a object is not an istance of a class )
+ 7
method = function inside a class
(I didn't say "both are the same")
+ 1
in some languages are diferent; functions have a return and method don't.