- Fork this repository to start a new project in your repos folder =>
git clone <JavaScript_Operators>
- cd JavaScript_Operators to navigate into your new repo directory
- Type the command code . to open VSC with the JavaScript_Operators folder
- Open the app.js file
- Declare 2 variables,
a
andb
, and assign 20 toa
and 4 tob
- Declare a variable
add
that uses the+
operator to store the result of adding the values stored ina
andb
- Declare a variable
minus
that uses the-
operator to store the result of subtracting the values stored ina
andb
- Declare a variable
multiply
that uses the*
operator to store the result of multiplying the values stored ina
andb
- Declare a variable
dividing
that uses the/
operator to store the result of dividing the values stored ina
andb
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 num = 11;
let str = "11";
let str2 = "eleven";
let isPresent = true;
let firstName = "Frodo";
let lastName = "Baggins";
- What is the value of: num + str?
- What is the value of: num + str2?
- What is the value of: num + isPresent?
- What is the value of: firstName + num?
- What is the value of: isPresent + str?
- What is the value of: firstName + lastName?
Use the code above to test and print the results.
- Use the following code to answer the questions below:
let val = 5;
let str3 = "5";
let str4 = "five";
let isPresent = false;
- What is the value of: val == str3?
- What is the value of: val === str3?
- What is the value of: !isPresent?
- What is the value of: (“eleven” == str4 && val >= str3)?
- What is the value of: (!isPresent || isPresent)?
- 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.