-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path9. Q9.js
More file actions
31 lines (25 loc) · 806 Bytes
/
9. Q9.js
File metadata and controls
31 lines (25 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 09. Boolean value is either true or false.
// - Write three JavaScript statement example which provide truthy value.
// - Write three JavaScript statement example which provide falsy value.
// Falsy Values
// 1. 0 //Zero
// 2. "" //Empty String
// 3. null
// 4. undefined
// 5. NaN //Not A Number
// 6. false
// This are all falsy values. Everything other than this are truthy values.
// Three statements of truthy values -
let myName = "Sayantan";
let age = 23;
let coder = true;
// Three statements of falsy values -
let newName = "";
let newAge = 0;
let newCoder = undefined;
const val = newAge; // Assign any of the above variable to val to determine either it is truthy or falsy value
if (val) {
console.log("It is a truthy value");
} else {
console.log("It is a falsy value");
}