I'm quite new in Node.js (and Javascript in general) programming and I have a huge doubt. I would like to restyle some code I've written in order to fit the OOP style, so I need to define some classes: but how should I do that?
I've read the Mozilla introduction and it seems like I should use "prototype" when defining new methods inside a class:
myClass.prototype.myFunction = function() { ... }
but in many JavaScript projects (for example on Github) I noticed a different way of defining functions, by using something like
self.myFunction = function () { ... }
So, which one is the style you suggest? And what differences there are between them?
Thank you very much for your help! :)