I'm using an API to get values to append to the DOM, out of the array a few of the values return null leaving them empty in the table. My question is it possible to return a string that states the "information is missing" instead of returning empty?
success: function(currency) {
// loop through currency
for (var i = 0; i < currency.length; i++) {
if (currency[i].currency == userCurrency) {
var $tr = $("<tr />");
$tr.append($("<td />").text(currency[i].volume));
$tr.append($("<td />").text(currency[i].latest_trade));
$tr.append($("<td />").text(currency[i].bid));
$tr.append($("<td />").text(currency[i].high));
$("#theTable tbody").append($tr);
}
}
}
});
});
});
.text(currency[i].bid || 'information is missing'));