forked from truecodersio/JavaScript_Operators
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
65 lines (53 loc) · 1.28 KB
/
app.js
File metadata and controls
65 lines (53 loc) · 1.28 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
console.log("JS Operators");
// Exercise 1
let a = 20;
let b = 4;
let add = a + b; // 24
let subtract = a - b; // 16
let multiply = a * b; // 80
let divide = a / b; // 5
let mod = a % b; // 0
let exponent = a ** b; // 160000
console.log(add, subtract, multiply, divide, mod, exponent)
// Exercise 2
let c = 11;
let str = "11";
let str2 = "eleven";
let isPresent = true;
let firstName = "Jackie";
let lastName = "Chan";
// c + str = 1111
// c + str2 = 11eleven
// c + isPresent = 12
// c + firstName = 11Jackie
// c + lastName = 11Chan
console.log(c + str);
console.log(c + str2);
console.log(c + isPresent);
console.log(c + firstName);
console.log(c + lastName);
// Exercise 3
let d = 5;
let str3 = "5";
let str4 = "five";
let isPresent2 = false;
let firstName2 = "Robin";
let lastName2 = "Williams";
console.log(d == str3);
console.log(d === str3);
console.log(!isPresent2);
console.log("eleven" == str4 && d >= str3);
console.log(!isPresent2 || isPresent2);
console.log(0 == false);
console.log(0 === false);
console.log(0 != false);
console.log(0 !== false);
// d == str3 = true
// d === str3 = false
// !isPresent2 = true
// "eleven" == str4 && d >= str3 = false
// (!isPresent2 || isPresent2) = true
// 0 == false = true
// 0 === false = false
// 0 != false = false
// 0 !== false = true