0

I got this line of code:

htmlTmp += htmlTDX.replace('#FIELD#', checkoutToday[b].deposit);

Now checkoutToday[b].deposit will either hold a numeric value, or it will be undefined.

I do not want it to say "undefined" but just blank or 0 if undefined.

If there a way to do this in one line? Or is my only option:

if (checkoutToday[b].deposit) {
    htmlTmp += htmlTDX.replace('#FIELD#', checkoutToday[b].deposit);
} else {
    htmlTmp += htmlTDX.replace('#FIELD#', 0);
}
torbenrudgaard
  • 2,375
  • 7
  • 32
  • 53

0 Answers0