-2

Can someone give a simple explanation of methods vs. functions in Javascript context? I have not found any answer on stack overflow

NullPointer
  • 7,094
  • 5
  • 27
  • 41

2 Answers2

1

I think both are pretty much synonym. However, you might want to use the term Method when it is a function within an class/object.

You can read more there:

https://softwareengineering.stackexchange.com/questions/20909/method-vs-function-vs-procedure

Wonay
  • 1,160
  • 13
  • 35
1

In a practical sense, absolutely nothing. They are the same.

In a semantic sense, a method is simply a function that belongs to an object or class.

This is the same for pretty much every language out there as well. Another term in the same basket is "sub-routine", which is again, pretty much the same exact thing as a function.

samanime
  • 25,408
  • 15
  • 90
  • 139