Declare 2 variables, a and b, and assign 20 to a and 4 to b Declare a variable add that uses the + operator to store the result of adding the values stored in a and b Declare a variable minus that uses the - operator to store the result of subtracting the values stored in a and b Declare a variable multiply that uses the * operator to store the result of multiplying the values stored in a and b Declare a variable dividing that uses the / operator to store the result of dividing the values stored in a and b You can print the value of the variables to the browser console (ex: console.log(add)) to check the result.
Use the following code to answer the questions below: let a = 11; let str = "11"; let str2 = "eleven"; let isPresent = true; let firstName = "Jackie"; let lastName = "Chan";
What is the value of: a + str? What is the value of: a + str2? What is the value of: a + isPresent? What is the value of: a + firstName? What is the value of: a + lastName? Use the code above to test and print the results.
Use the following code to answer the questions below: let d = 5; let str3 = "5"; let str4 = "five"; let isPresent2 = false; let firstName2 = "Robin"; let lastName2 = "Williams";
What is the value of: d == str3? What is the value of: d === str3? What is the value of: !isPresent2? What is the value of: (“eleven” == str4 && d >= str3)? What is the value of: (!isPresent2 || isPresent2)? What is the value of: 0 == false? What is the value of: 0 === false? What is the value of: 0 != false? What is the value of 0 !== false? Use the code above to test and print the results.
//---------------------------------------------------------------------
Initialize an integer to represent a favorite number and assign a value with a number of your choosing or you can assign a random number to this variable.
Use window.prompt() to ask the user to input a number, and store the result in a variable
Create an if-statement that if the guessed number is below the initial value, print out “too low”.
Create an else-if statement that if the number is higher than the initial value, print out “too high”.
Create an else statement that prints out “Congratulations!!!”.
Declare a variable named userInput2 (or whatever topic you’ll ask about) and set the value to window.prompt(“Whatever question you want to ask here”).
Inside of the parentheses, ask a question on whatever (appropriate) topic you’d like.
Create a switch-case statement with 5+ cases and a default case. Log a response to the console depending on the value of userInput2.