-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathlogical-comaprison-operators.js
79 lines (51 loc) · 3.13 KB
/
logical-comaprison-operators.js
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
//Logical and Comparison Operators
/*******************************************************************************
TASK 1:
In this task, you will be presented with a series of expressions that you need to evaluate and determine if the result is true or false.
// Have fun! // 😃
********************************************************************************/
const exp1 = 10 >= 10; // TODO: ADD YOUR EVALUATION HERE -->
const exp2 = "dog" == "dog"; // TODO: ADD YOUR EVALUATION HERE -->
const exp3 = true != false; // TODO: ADD YOUR EVALUATION HERE -->
const exp4 = "10" === 10; // TODO: ADD YOUR EVALUATION HERE -->
const exp5 = 5 > 4; // TODO: ADD YOUR EVALUATION HERE -->
const exp6 = null == undefined; // TODO: ADD YOUR EVALUATION HERE -->
const exp7 = "true" == true; // TODO: ADD YOUR EVALUATION HERE -->
const exp8 = "false" == false; // TODO: ADD YOUR EVALUATION HERE -->
const exp9 = NaN === NaN; // TODO: ADD YOUR EVALUATION HERE -->
const exp10 = !false || false; // TODO: ADD YOUR EVALUATION HERE -->
const exp11 = false && !false; // TODO: ADD YOUR EVALUATION HERE -->
const exp12 = "apple" > "pineapple"; // TODO: ADD YOUR EVALUATION HERE -->
const exp13 = "2" > "12"; // TODO: ADD YOUR EVALUATION HERE -->
const exp14 = undefined == null; // TODO: ADD YOUR EVALUATION HERE -->
const exp15 = undefined === null; // TODO: ADD YOUR EVALUATION HERE -->
/*******************************************************************************
Task 2:
In the following tasks, you will practice using logical operators in JavaScript, in addition to some strings methods.
// Have fun! // 😃
********************************************************************************/
const num = 15;
const str = "Hakuna Matata";
const isHappy = false;
// - Check if num is between 10 and 20 (inclusive) using the logical AND operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if num is either less than 5 or greater than 50 using the logical OR operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if str is either "apple" or "orange" using the logical OR operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if isHappy value is true using the logical NOT operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if num is even and greater than 10 using the logical AND operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if num is divisible by both 3 and 5 using the logical OR operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if str contains the letter "e". Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if str starts with "Hakuna". Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if str ends with "a". Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if num is either negative or odd using the logical OR operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW
// - Check if the length of str is greater than num or equal to 40 using logical OR operator. Log the result to the console.
// TODO: ADD YOUR CODE BELOW