Skip to content

Commit 89413db

Browse files
.
1 parent df4ea0b commit 89413db

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

logic/logical-operators.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@ console.log(10 < 4 || 7 < 2);
1313
// && - return the first truthy value or the last one
1414

1515
let a;
16+
17+
a = 10 && 20;
18+
a = 10 & 30 && 50;
19+
20+
console.log(a);
21+
22+
// real world application
23+
24+
const posts = [""];

logic/truthy-falsy.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,15 @@ if (Object.keys(users).length < 0) {
7474
}
7575

7676
// since an empty object will return "true" we can use the javascript method to convert to array and then check the length
77+
78+
// working with arrays
79+
80+
const arr = [];
81+
82+
if (arr) {
83+
console.log(
84+
"love is a higher revelation than all the wisdom and philosophy. "
85+
);
86+
} else {
87+
console.log("");
88+
}

0 commit comments

Comments
 (0)