Home > Enterprise >  Get empty string instead of null
Get empty string instead of null

Time:01-29

I have null in a row if there no number. I need to put empty string in a row instead of null.

<td>${number}</td>. // null, if there no number,

so, Am I thinking in the right way? :

!number ? number : "" 

CodePudding user response:

This will check if the variable's type is number and if not it won't render anything:

typeof number === 'number' ? number : ''

CodePudding user response:

try

`<td>${!number ? '' : number}</td>`

if there is no number then display '' else display number

  •  Tags:  
  • Related