If I'm returning any value(primitive of type number in this case) from a constructor function then that value is not respected and returned.
function Run() {
this.isRunning = () => {
return this;
}
return 100;
}
const obj = new Run();
console.log(obj === 100); // It should log true
Above code snippet should return true
, instead it returns an implicitly created object. why is that so?