I have writtern this two different ways and both giving me same result , so which I can use when ?
FIRST EXAMPLE
var BaseCls = function() {
BaseCls.prototype.name = "John";
};
var JustCls = new BaseCls();
console.log(JustCls.name); // This is giving result John
SECOND EXAMPLE
var BaseCls = function() {};
BaseCls.prototype.name = "John";
var JustCls = new BaseCls();
console.log(JustCls.name); // This is also giving result John
Both giving me same result so I just want to know is there any other criteria which lead to write this property / method with prototype inside / outside main function ?
Thanks for consideration