-1
In the final result object, I could have several items, sometimes these are not registered, so I would like to avoid showing empty tags on the screen. Example:
mostrador.innerHTML = filtrados.map(
(obj) => `
<h4>${obj.cidade}</h4>
<p>${obj.empresa}</p>
<p>${obj.representante}</p>
<p>${obj.telefone}</p>
<p>${obj.email}</p>
<p>${obj.empresa2}</p>
<p>${obj.representante2}</p>
<p>${obj.telefone2}</p>
<p>${obj.email2}</p>
`,
In the case of company2, representant2, phone2 and Email2 are not filled in, how could I check this to show only tags with strings filled in?
Try it like this:
${obj.empresa2 || ''}
– Sam
@dvd just can’t do that inside the element
<p>
, because it will still occupy the space on the screen, even empty.– Woss