diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6b665aa --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} diff --git a/index.html b/index.html index 9eb7d90..e237bdf 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Variables and Operators - + diff --git a/logical-comaprison-operators.js b/logical-comaprison-operators.js index aea6930..80d2b59 100644 --- a/logical-comaprison-operators.js +++ b/logical-comaprison-operators.js @@ -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 -->true -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 -->true -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 -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 -->false -const exp13 = "2" > "12"; // TODO: ADD YOUR EVALUATION HERE --> +const exp13 = "2" > "12"; // TODO: ADD YOUR EVALUATION HERE -->false -const exp14 = undefined == null; // TODO: ADD YOUR EVALUATION HERE --> +const exp14 = undefined == null; // TODO: ADD YOUR EVALUATION HERE -->true -const exp15 = undefined === null; // TODO: ADD YOUR EVALUATION HERE --> +const exp15 = undefined === null; // TODO: ADD YOUR EVALUATION HERE -->false /******************************************************************************* Task 2: @@ -43,37 +43,38 @@ Task 2: ********************************************************************************/ const num = 15; const str = "Hakuna Matata"; -const isHappy = false; +const isHappy = true; // - 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%2===0 && 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==0 || num%5==0); // - 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 - +// TODO: ADD YOUR CODEBELOW +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 || num%2==1); // - 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>15 ||str.length==40 ); \ No newline at end of file diff --git a/variables.js b/variables.js index 2d8a281..78f88d8 100644 --- a/variables.js +++ b/variables.js @@ -15,7 +15,9 @@ 2. Use console.log() to output the value of each variable. ********************************************************************************/ // TODO: ADD YOUR CODE BELOW - +let personName='ali'; +let age=10; +let isHappy=true; /******************************************************************************* Task 2 (Reassigning variables): @@ -24,7 +26,8 @@ 2. Use console.log o output the value of 'nickName' *******************************************************************************/ // TODO: ADD YOUR CODE BELOW - +let nickName ='ali'; +console.log(nickName); /******************************************************************************* Task 3 (Naming variables): @@ -33,7 +36,8 @@ 2. Declare a variable that stores the age of a user. What name would you choose for this variable? *******************************************************************************/ // TODO: ADD YOUR CODE BELOW - +let MyFavmovie = "the shake"; +let AgeOfUser=10; /******************************************************************************* Task 4 (String Concatenation): Build upon the previous task by completing the following steps: @@ -48,3 +52,15 @@ Steps: - Print the final message to the console, including the personName in uppercase in this format `Dear personName_VALUE, here's your message: finalMsg_VALUE.`. *******************************************************************************/ // TODO: ADD YOUR CODE BELOW +let msg; +let person = prompt("enter amessage"); + +if (isHappy !=true) { + document.getElementById(msg).innerHTML = + "And btw, Why are you happy? "?; + else(isHappy!=false){ + document.getElementById(msg).innerHTML = + "And btw, Good for you. There's nothing to be happy about" +} +} +console.log(person); \ No newline at end of file