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

144
Views
Why the empty object { } and the empty array [ ] aren’t falsy, how they are truthy, by definition

ref:https://medium.com/coding-at-dawn/what-are-falsy-values-in-javascript-ca0faa34feb4 by Dr. Derek Austin

Since I have started my development career with JavaScript this question always arise in mind how??

Truthy values include the empty object {} and the empty array [] — since they aren’t falsy, they are truthy, by definition.

let empty = []
empty ? console.log("truthy") : console.log("falsy") // truthy
empty = {}
empty ? console.log("truthy") : console.log("falsy") // truthy

where,

"" ? console.log("truthy") : console.log("falsy") // falsy
about 4 years ago · Juan Pablo Isaza
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!