I have Javascript function and I want to check multiple if statements in return.
If the value exist or is not null then it should return a row with information,
I am not sure how to do this, I am thinking something like this, E.g:
function format(d){
return '<table cellpadding="5" cellspacing="0" border="0">' +
if (name) {
'<tr>' +
'<td>Name:</td>' +
'<td>' + d.name + '</td>' +
'</tr>' } +
if (place)
'<tr>' +
'<td>Place:</td>' +
'<td>' + d.place + '</td>' +
'</tr>' } +
if (date) {
'<tr>' +
'<td>Date:</td>' +
'<td>' + d.date + '</td>' +
'</tr>' } +
'</table>';
}
if- its not an expression - you could youse ternary but thats messy - consider using building the string on your way out