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

249
Views
What's the difference between ( ' ' || false) and (false || ' ' ) in JavaScript?

In developer.mozilla website there are some examples to show different usage of logical OR operator, but this two examples got my attention, here they are :

o8 = ''    || false      // f || f returns false
o9 = false || ''         // f || f returns ""

Why this two, return different results? I expected both of them return false.

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

See in the same page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR

expr1 || expr2

If expr1 can be converted to true, returns expr1; else, returns expr2.

about 4 years ago · Santiago Trujillo Report

0

All variables are falsy, so during each evaluation, because the first operand (left side) is coalesced to a falsy value, the operand on the right side of the || will be used.

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!