This question has already been answered:

Friends, the question is:

console.log({a:"a"} && {b:"b"}); // {b:"b"} 

why the operator "&&" with objects results in an object and why the second?

Reported as a duplicate at Grundy. javascript Oct 12 '18 at 6:26 pm

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

1 answer 1

in this case, && works like if

learn.javascript.ru -> Logical Operators-> Operator And

  • Thanks @qwabra. And where can you look about it? - Andrey
  • Thanks @Igor. Already saw - Andrew
  • @Andrey , edited the answer - qwabra