So I have this:
var setting = function (val,desc) {
this.val = val;
this.desc = desc;
};
var option = new setting(15,"This is a setting");
and I was wondering if I could get option to return value rather than the object.
I tried adding this to setting
var setting = function (val,desc) {
this.val = vall;
this.desc = desc;
return this.val;
};
But it didn't work. Is it even possible? I'd like the option to return val, but still have option.val return val and option.desc to return desc.
this.val = val ? val : nullis the same asthis.val = val || nullwhich can be justthis.val = valin your context, sincenull == undefined