Skip to content

jkpeople/JavaScript_Operators

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 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

let x = 20; let y = 4;

  1. Declare a variable add that uses the + operator to store the result of adding the values stored in a and b

let add = x + y;

  1. Declare a variable minus that uses the - operator to store the result of subtracting the values stored in a and b

let minus = x - y;

  1. Declare a variable multiply that uses the * operator to store the result of multiplying the values stored in a and b

let multiply = x * y;

  1. Declare a variable dividing that uses the / operator to store the result of dividing the values stored in a and b

let divide = x / y;

let exp = x ** y;

let mod = x % y;

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 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.

Exercise 3

  1. Use the following code to answer the questions below:
let a = 5;
let str = "5";
let str2 = "five";
let isPresent = false;
let firstName = "Robin";
let lastName = "Williams";
  • What is the value of: a == str?
  • What is the value of: a === str?
  • What is the value of: !isPresent?
  • What is the value of: (“eleven” == str2 && a >= str)?
  • 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 74.5%
  • HTML 25.5%