I wanna know when do we use logical operators with non-booleans in a real project also in experimental tests (exactly I mean something like var a = name || 'Adele';
at the example code, where one of the two operands of a logical operator is non-boolean)?
For example, in the program below, someone said " when we're not sure that name
already has a value or not, as a callback, we add || 'Adele'
to that ". But also I want to know more about such usage.
Thanks!
var name;
//
//
//
var a = name || 'Adele';
console.log(a); // ...