NODE
node
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
console.log("abc" && 11); // 11
console.log("abc" || 11); // abc
// stop evaluation at "abc" since true || anything = true
console.log(false || "abc" || "xyz");
// stop evaluation at "xyz" since it comes after the last &&
console.log(false || "abc" && "xyz"); // xyz
// stop evaluation at "abc" since false || "abc" returns "abc", and ture || anything = true
console.log(false || "abc" || false); // abc
// stop evaluation at "xyz" since "abc" && "xyz" is evaluated first, and ture || anything = ture
console.log("abc" && "xyz" || "101"); // xyz
// false && "xyz" is evaluated first because, and false || ture = ture
console.log(false && "xyz" || "101"); // 101
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run