+ 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

15th Apr 2017, 7:54 AM
Rajeev
Rajeev - avatar
4 ответов
+ 11
I only heard that: C++ says use functions Java says use methods Both are same.
15th Apr 2017, 9:37 AM
Sachin Artani
Sachin Artani - avatar
+ 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 )
15th Apr 2017, 8:26 AM
Maz
Maz - avatar
+ 7
method = function inside a class (I didn't say "both are the same")
15th Apr 2017, 8:22 AM
Geoffrey L
Geoffrey L - avatar
+ 1
in some languages are diferent; functions have a return and method don't.
4th Oct 2017, 9:24 PM
Sinuhé Masán
Sinuhé Masán - avatar