-
Notifications
You must be signed in to change notification settings - Fork 23
Variables-and-Operators-Task #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
451c7d8
ab4e2b3
7bcb5cd
7402a23
36df0f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,16 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Variables and Operators</title> | ||
| </head> | ||
| <body> | ||
| <script src="./variables.js"></script> | ||
| </head> | ||
| <body> | ||
| <!-- <script src="./variables.js"></script> --> | ||
| <!-- <script src="./arthimetic-operators.js"></script> --> | ||
| <script src="./logical-comaprison-operators.js"></script> | ||
| <!-- <script src="./arthimetic-operators.js"></script> --> | ||
| <!-- <script src="./logical-comaprison-operators.js"></script> --> | ||
| </body> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,35 +6,35 @@ TASK 1: | |
| // Have fun! // 😃 | ||
| ********************************************************************************/ | ||
|
|
||
| const exp1 = 10 >= 10; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp1 = 10 >= 10; // TODO: ADD YOUR EVALUATION HERE --> true | ||
|
|
||
| const exp2 = "dog" == "dog"; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp2 = "dog" == "dog"; // TODO: ADD YOUR EVALUATION HERE --> true | ||
|
|
||
| const exp3 = true != false; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp3 = true != false; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
|
||
| const exp4 = "10" === 10; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp4 = "10" === 10; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
|
||
| const exp5 = 5 > 4; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp5 = 5 > 4; // TODO: ADD YOUR EVALUATION HERE --> true | ||
|
|
||
| const exp6 = null == undefined; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp6 = null == undefined; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should return This would return |
||
|
|
||
| const exp7 = "true" == true; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp7 = "true" == true; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
|
||
| const exp8 = "false" == false; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp8 = "false" == false; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
|
||
| const exp9 = NaN === NaN; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp9 = NaN === NaN; // TODO: ADD YOUR EVALUATION HERE --> true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should evaluate to |
||
|
|
||
| const exp10 = !false || false; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp10 = !false || false; // TODO: ADD YOUR EVALUATION HERE --> true | ||
|
|
||
| const exp11 = false && !false; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp11 = false && !false; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
|
||
| const exp12 = "apple" > "pineapple"; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp12 = "apple" > "pineapple"; // TODO: ADD YOUR EVALUATION HERE --> apple | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the expression |
||
|
|
||
| const exp13 = "2" > "12"; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp13 = "2" > "12"; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should evaluate to |
||
|
|
||
| const exp14 = undefined == null; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp14 = undefined == null; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should evaluate to true. |
||
|
|
||
| const exp15 = undefined === null; // TODO: ADD YOUR EVALUATION HERE --> | ||
| const exp15 = undefined === null; // TODO: ADD YOUR EVALUATION HERE --> false | ||
|
|
||
| /******************************************************************************* | ||
| Task 2: | ||
|
|
@@ -47,33 +47,34 @@ 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 | ||
|
|
||
| console.log(num >= 10 && num <= 20); | ||
| // - 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 | ||
|
|
||
| console.log(num < 5 || num >50) | ||
| // - Check if str is either "apple" or "orange" using the logical OR operator. Log the result to the console. | ||
| // TODO: ADD YOUR CODE BELOW | ||
|
|
||
| console.log(str == "apple" || str == "orange") | ||
| // - Check if isHappy value is true using the logical NOT operator. Log the result to the console. | ||
| // TODO: ADD YOUR CODE BELOW | ||
|
|
||
| console.log(!isHappy) | ||
| // - 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 | ||
|
|
||
| console.log(num == 10 && num >10) | ||
| // - 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 | ||
|
|
||
| console.log(num/3 || num/5) | ||
| // - Check if str contains the letter "e". Log the result to the console. | ||
| // TODO: ADD YOUR CODE BELOW | ||
|
|
||
| console.log(str.includes("e")) | ||
| // - Check if str starts with "Hakuna". Log the result to the console. | ||
| // TODO: ADD YOUR CODE BELOW | ||
|
|
||
| console.log(str.startsWith("Hakuna")) | ||
| // - Check if str ends with "a". Log the result to the console. | ||
| // TODO: ADD YOUR CODE BELOW | ||
|
|
||
| console.log(str.endsWith("a")) | ||
| // - Check if num is either negative or odd using the logical OR operator. Log the result to the console. | ||
| // TODO: ADD YOUR CODE BELOW | ||
|
|
||
| console.log(num == "negative"|| num == "odd") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To check if the number is negative correctly: |
||
| // - 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 | ||
| console.log(str.length > num || str.length == 40) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should return
trueinstead