0

I'm trying to get a Boolean value from a simple condition like this one :

let object = {name: 'test'};
console.log(1 == 1 && object);

But this console.log doesn't displays Boolean value true, but the entire object { name: 'test' }. Can you explain me why ?

Why do I have to use !!, to return a Boolean value like this ?

console.log(1 == 1 && !!object);

Thanks for help.

Sparw
  • 2,688
  • 1
  • 15
  • 34

0 Answers0