In Javascript, I can create a βclassβ like this:
var MyClass = function(){ return this; }; var myClassInstance = new MyClass();
What is the difference between doing the above and doing this:
var MyClass = {}; var myClassInstance = Object.create(MyClass);
Is there any reason to use one over the other?
source share