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

230
Views
Is "" ( empty-string ) equivalent to boolean false or a false(y) value?

Please explain a little bit on this topic. I have went through some articles but I have not satisfied with their explanations.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The empty string ("") returns falsy. An easy way to understand this is by using the logical AND operator

The logical AND operator

If the first object is falsy, it returns that object

console.log('' && 'hello') // falsy && 'hello' --> returns falsy empty string ('')
console.log('hi' && 'hello') // truthy && 'hello' --> returns 'hello'

  1. In the first console.log() the empty string is a falsy value and so it returns the empty string.

  2. In the second console.log() the non-empty string is a truthy value and so it returns the second string hello

about 4 years ago · Santiago Trujillo 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!