Difference between method and function? -introduction to objects


#1


What is the difference between a function and a method? functionally, don't they do the same thing?


#2

Not every function is a method, but every method is a function.
Method is a function that belongs to certain objects/classes.
For example: toUpperCase() in JavaScript is a method that belongs to String - you can use it on any string.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.