-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathequal-to.html
More file actions
47 lines (41 loc) · 1.09 KB
/
equal-to.html
File metadata and controls
47 lines (41 loc) · 1.09 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
<!--https://livecode.codeadam.ca/codeadamca-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>If Statement Comparisons</title>
</head>
<body>
<script>
let var1 = "0";
let var2 = 0;
// Compare data only
// In this exmaple these are ==
if (var1 == var2) {
console.log("Variables are equal!");
} else {
console.log("Variables are not equal!");
}
// Compare data AND type
// In this example these are NOT ===
if (var1 === var2) {
console.log("Variables are equal!");
} else {
console.log("Variables are not equal!");
}
let name = "Humby";
if (name == "Humby"); // True
if (name == "Peter"); // False
if (name != "John"); // True
if (name);
if ("Humby"); // True
let number = 0;
if (number == 0); // True
if (number); // False
let email = "";
if (email); // False
if (!email); // True
</script>
</body>
</html>