The following dynamically generated javascript is returning undefined
when I try to run it using eval()
. If I remove the if/else
statements, it returns 0
but when I try to use the if/else
statements, it's returning undefined
.
function doCalculation() {
var OfferSupport=0;
var DOOfferSupport=4;
var SupportFull=SupportFull;
var SupportNone=SupportNone;
if(DOOfferSupport >= 1)
OfferSupport = SupportFull ;
else
OfferSupport = SupportNone ;
return OfferSupport;
}
console.log('test: ' + doCalculation());
Can anyone tell me why?