Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Get empty string instead of null

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 : "" 
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

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

typeof number === 'number' ? number : ''
about 4 years ago · Juan Pablo Isaza Report

0

try

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

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

about 4 years ago · Juan Pablo Isaza Report

0

You can use Nullish coalescing operator (??) that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand.

Working Demo :

let number = null;

document.getElementById('numberText').innerHTML = number ?? ''
<p id="numberText"></p>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!