When I call the method getResult it returns an undefined value. What am I doing wrong?
var MyObjectResult = {"Success":1, "Fail":2, "Timeout":3, "None":4}
function MyObject()
{
this.result = MyObjectResult.None;
this.timout = 15;
this.getResult = function ()
{
// Some calculation here and changing result
// Logging (this.result shows that result has value of 1)
this.result = MyObjectResult.Success;
return this.result;
}
}
var myObject = new MyObject();
var result = myObject.getResult();
// result is undefined
console.log(result);