Classes contain methods, and functions are first class citizens of the language. Sometimes we use these terms interchangeably, but they're strictly different.
To understand their relationship, read this article by Jim McBeath.
If you want more depth, these two articles can help:
Have a good understanding of methods and functions? Take the short quiz below to make sure before you move on to Expressions vs. Statements .