-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpgSeven.js
More file actions
56 lines (49 loc) · 1.55 KB
/
pgSeven.js
File metadata and controls
56 lines (49 loc) · 1.55 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
const pgSeven = "///////////// THIS IS PAGE SEVEN /////////////";
console.log(pgSeven);
///// Conditionals
// == means equal to data but not a specific match. actually a hot mess in my opinion.
// === means equal to data type. a specific match
// || means 'or'
// && means 'and'
// ? aka 'if' means 'ternary operator' a shorthand if statement. usually followed by : aka 'else'
//used a lot to assign variables assigned to a condition.
const x = 10;
// // const x = 20;
// // const x = 2;
//multiple conditions
const y = 16;
////// this is cleaner! DRY 2020 with || or conditional
// if (x > 5 || y > 15) {
// console.log("x is more than 5 and/or y is more than 15");
// }
// this is cleaner! DRY 2020 with && and conditional
if (x > 5 && y > 15) {
console.log("x is more than 5 and/or y is more than 15");
}
// //seeing if x is equal to 10. the value x is assigned above
// if (x === 10) {
// console.log("x is 10");
// // seeing if x is greater than 10. the value x is assigned above
// } else if (x > 10) {
// console.log("x is greater than 10");
// // if x is not 10 or greater than. the value x is assigned above
// } else {
// console.log("x is NOT 10");
// }
//ternary operator if value is
// const c = 5;
const c = 50;
const color = c > 10 ? "red" : "blue";
console.log(color);
/// SWITCH. another way to evaluate a condition
const vibrance = "purple";
switch (vibrance) {
case "yellow":
console.log("color is yellow");
break;
case "orange":
console.log("color is orange");
break;
default:
console.log("color is NOT yellow or orange");
}