Adding functions to an object is simple and they are called methods when a property of an object.
Ensure that you utilize the “new” keyword, otherwise unintended consequences will occur including properties leaking to the global scope.
To add methods to this class, a function is assigned to the prototype of the class. The prototype stores all methods associated with a class.
Do not add the function declaration inside of the class constructor as seen below.
To view the presentation from DevMynd, please see the GitHub page. Most of the code snippets are taken from their presentation.