My shorthand version of if else return me an error, and I have no idea why, for me both of them do the same thing, but why the second one failed?
//using if else
if (sd.cancellationDetails.cancellationSummary) {
console.log(sd.cancellationDetails.cancellationSummary.totalRefundAmount)
}
//shorthand
html += '<td>' + sd.currencyType + (sd.cancellationDetails.cancellationSummary) ? sd.cancellationDetails.cancellationSummary.totalRefundAmount : '0.00' + '</td>'
Aucun commentaire:
Enregistrer un commentaire