I have this simple array with objects and values, but not all objects have same values:
var array = [
{name: 'aaa', mobile: '111-111'},
{name: 'bbb', mobile: '222-222', adress: '333-333'},
{name: 'ccc', mobile: '444-444', adress: '555-555'}
]
the first object doesn't have an address.
so when I tried to append it to html I got undefined word:
jQuery:
$('ul').append(
'<li>'+array[i].name+'</li>'+
'<li>'+array[i].mobile+'</li>'+
'<li>'+array[i].adress+'</li>'+
)}
HTML:
<li>aaa</li>
<li>111-111</li>
<li>undefined</li>
<li>bbb</li>
<li>222-222</li>
<li>333-333</li>
how can to check if this value not exist then show nothing instead of undefined word?, or even to not show the whole li tag?