JavaScript 8

¡Supera tus tareas y exámenes ahora con Quizwiz!

... (===) is the counterpart to the equality operator (==). Unlike the equality operator, strict equality tests both the ... and ... of the compared elements.

Strict equality data type and value

Comparison with the Less Than Operator Instructions Add the less than operator to the indicated lines so that the return statements make sense. function myTest(val) { if (val) { // Change this line return "Under 25"; } if (val) { // Change this line return "Under 55"; } return "55 or Over"; } // Change this value to test myTest(10);

function myTest(val) { if (val < 25) { // Change this line return "Under 25"; } if (val < 55) { // Change this line return "Under 55"; } return "55 or Over"; } // Change this value to test myTest(10);

The ... is the opposite of the equality operator.

inequality operator (!=)

Like the equality operator, greater than operator will ... . Examples 5 > 3 // true 7 > '3' // true 2 > 3 // false '1' > 9 // false

convert data types of values while comparing

It means ... and returns ... where equality would return true and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing. Examples 1 != 2 // true 1 != "1" // false 1 != '1' // false 1 != true // false 0 != false // false

"Not Equal" false

Comparison with the Inequality Operator Instructions(my) Create a function called myTest with param val. If val is not equal to 99 the function will return "Not Equal" otherwise it will return "Equal".

// Setup function myTest(val) { if (val != 99) { // Change this line return "Not Equal"; } return "Equal"; } // Change this value to test myTest(10);

Comparison with the Strict Equality Operator Instructions (my) Create a function called myTest with parameter val. Add an if statement that returns "Equal" when val is strictly equal to 7 otherwise returns "Not Equal".

// Setup function myTest(val) { if (val === 7) { // Change this line return "Equal"; } return "Not Equal"; } // Change this value to test myTest(7);

Examples 3 === 3 // true 3 === '3' // false In the second example, 3 is a Number type and '3' is a String type.

Examples 3 === 3 // true 3 === '3' // false In the second example, 3 is a Number type and '3' is a String type.

===

Strict equality

free card!

Yep!

Comparison with the Less Than Or Equal To Operator Instructions Add the less than or equal to operator to the indicated lines so that the return statements make sense. function myTest(val) { if (val) { // Change this line return "Smaller Than or Equal to 12"; } if (val) { // Change this line return "Smaller Than or Equal to 24"; } return "25 or More"; } // Change this value to test myTest(10);

function myTest(val) { if (val <= 12) { // Change this line return "Smaller Than or Equal to 12"; } if (val <= 24) { // Change this line return "Smaller Than or Equal to 24"; } return "25 or More"; } // Change this value to test myTest(10);

Comparison with the Strict Inequality Operator Instructions (my) Write a function named myTest with param val. Using a strict inequality operator in an if statement, have the function return "Not Equal" when val is not strictly equal to 17. Otherwise, return "Equal".

function myTest(val){ if (val !== 17) { return "Not Equal"; } return "Equal"; } myTest(17);

Comparison with the Greater Than Or Equal To Operator Instructions(my) Create a function name testGreaterOrEqual with param val. If val is greater than or equal to 20, return "20 or Over". If val is greater than or equal to 10, return "10 or Over". Otherwise, return "9 or Under".

function testGreaterOrEqual(val){ if (val >= 20){ return "20 or Over"; } if (val >= 10){ return "10 or Over"; } return "9 or Under"; } testGreaterOrEqual(25);

Comparison with the Greater Than Operator Instructions (my) Write a function named testGreaterThan with param val. The first if statement should test if val is greater than 100. If so, return "Over 100". The second if statement should test if val is greater than 10. If so, return "Over 10". Otherwise return "10 or Under".

function testGreaterThan(val) { if (val > 100) { return "Over 100"; } if (val > 10) { return "Over 10"; } return "10 or Under"; } testGreaterThan(10);

The ... compares the values of two numbers. If the number to the left is ... than the number to the right, it returns true. Otherwise, it returns false.

greater than operator (>) greater

The ... compares the values of two numbers. If the number to the left is ... the number to the right, it returns true. Otherwise, it returns false. Like the equality operator, ... will convert data types while comparing.

greater than or equal to operator (>=) greater than or equal to greater than or equal to operator Examples 6 >= 6 // true 7 >= '3' // true 2 >= 3 // false '7' >= 9 // false

The strict ... is the opposite of the strict equality operator. It means ... and returns false where strict equality would return true and vice versa. Strict inequality will not convert data types.

inequality operator (!==) "Strictly Not Equal" Examples 3 !== 3 // false 3 !== '3' // true 4 !== 3 // true

The less than ... compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. Otherwise, it returns false. Like the equality operator, ... converts data types while comparing. Examples 2 < 5 // true '3' < 7 // true 5 < 5 // false 3 < 2 // false '8' < 4 // false

less than operator (<) less than operator

The ... compares the values of two numbers. If the number to the left is less than or equal the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than or equal to converts data types.

less than or equal to operator (<=) Examples 4 <= 5 // true '7' <= 7 // true 5 <= 5 // true 3 <= 2 // false '8' <= 4 // false

3 === '3' // false

strict equality tests for data type and value. The data types do not match up.


Conjuntos de estudio relacionados

History of Rock & Roll Final Study 2

View Set

Chapter 49 Nervous Systems Key Concepts

View Set

Adaptive Quizzing Questions - Med Surg Ch. 44-46

View Set

Series 7 TO Math computations practice

View Set