I am reading a really nice blog on logical and (&&) in javascript. javascript-and-or-logical-operators/
How logical and works
Starting from left and moving to the right, return the first operand that is falsy. If no falsy operand was found, return the latest operand.
his example
FALSY:
3 && 1 && 0 && 10; // => 0
I see that it returns 0, based on his explanation above. But why is that? Why isn't false returned instead. I realize that 0 is "falsy", so I would believe that the statement would now evaluate to boolean false? But I am not right, can you explain why?
he also presents this example
TRUTHY
true && 1 && { name: 'John' } => { name: 'John' }
I am confused again. Why does this statement return { name: 'John' } instead of returning true?
Thank you kind people for your patience in answering my question.