Skip to content

jessermiller/JavaScript_Operators

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

JavaScript_Operators

Steps

  1. Fork this repository to start a new project in your repos folder => git clone <JavaScript_Operators>
  2. cd JavaScript_Operators to navigate into your new repo directory
  3. Type the command code . to open VSC with the JavaScript_Operators folder
  4. Open the app.js file

Exercise 1

  1. Declare 2 variables, a and b, and assign 20 to a and 4 to b
  2. Declare a variable add that uses the + operator to store the result of adding the values stored in a and b
  3. Declare a variable minus that uses the - operator to store the result of subtracting the values stored in a and b
  4. Declare a variable multiply that uses the * operator to store the result of multiplying the values stored in a and b
  5. 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.

Exercise 2

  1. 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? Answer: 1111 it concatanizes it.
  • What is the value of: num + str2? Answer: 11eleven
  • What is the value of: num + isPresent? Answer: 12
  • What is the value of: firstName + num? Answer: Frodo11
  • What is the value of: isPresent + str? Answer: true11
  • What is the value of: firstName + lastName? Answer: FrodoBaggins

Use the code above to test and print the results.

Exercise 3

  1. Use the following code to answer the questions below:
let val = 5;
let str3 = "5";
let str4 = "five";
let isAwake = false;
  • What is the value of: val == str3? Answer: true
  • What is the value of: val === str3? Answer: false
  • What is the value of: !isAwake? Answer: true
  • What is the value of: ("eleven" == str4 && val >= str3)? Answer: false
  • What is the value of: (!isAwake || isAwake)? Answer: true
  • What is the value of: 0 == false? Answer: true
  • What is the value of: 0 === false? Answer: false
  • What is the value of: 0 != false? Answer: false
  • What is the value of 0 !== false? Answer: true

Use the code above to test and print the results.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 60.7%
  • HTML 39.3%