-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpressions.js
More file actions
84 lines (51 loc) · 2.16 KB
/
Expressions.js
File metadata and controls
84 lines (51 loc) · 2.16 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
let a = 10;
let b = 5;
//Arithmetic Expressions
console.log("addition:" , a + b); // 15 (addition)
console.log("subtraction:" ,a - b); // 5 (subtraction)
console.log("multiplication" ,a * b); // 50 (multiplication)
console.log("division:", a / b); // 2 (division)
console.log("modulus:" ,a % b); // 0 (modulus)
//logical Expressions
// Logical OR Operator (||)
// A | B | Result
// --------------------------
// True | True | True
// True | False | True
// False | True | True
// False | False | False
console.log("logical OR:", (a > 15) || (b < 10)); // true (one condition is true)
// Logical AND Operator (&&)
// A | B | Result
// --------------------------
// True | True | True
// True | False | False
// False | True | False
// False | False | False
console.log("logical AND:", (a > 5) && (b < 10)); // true (both conditions are true)
//NOT Operator (!)
// A | Result
// ----------------
// True | False
// False | True
console.log("logical NOT:", !(a > b)); // false (negation of true)
//Comparison Expressions
console.log("equal to:", a == b); // false (equal to)
console.log("not equal to:", a != b); // true (not equal to)
console.log("greater than:", a > b); // true (greater than)
console.log("less than:", a < b); // false (less than)
console.log("greater than or equal to:", a >= b); // true (greater than or equal to)
console.log("less than or equal to:", a <= b); // false (less than
console.log("strict equal to:", a === b); // false (strict equal to)
console.log("strict not equal to:", a !== b); // true (strict not equal to)
//Condition Operator
// ? -> The Condition is True Print After This Symbol line
// : -> The Condition is Flase Print After This Symbol line
console.log(a ===10 ? "The A Value is 10" : "A Value Is Not 10");
var Age = 18;
var Result = Age > 18 ? "The Age Is More Than 18 " : "The Age Under The 18 "
console.log(Result);
console.log(20 > 10 < 5 ); // Output is true
// 20 > 10 = true
// true < 5 (true value is 1)
console.log("20" + 10 - 10);// output is 2000