JavaScript - Level 1 - All Operator Types

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Comparison Operator Types

The result of evaluating an equality operator is always of type Boolean value of either true or false and the value returned is based on whether the comparison is true ==, !=, ===, !==

Logical OR

|| Used to for a set of operands is true if and only if one or more of its operands is true.

Remainder (modulos)

% symbol used to return the remainder

Remainder (modulos) Assignment Operator (shorthand)

%= divides a variable by the value of the right operand and assigns the remainder to the variable.

Remainder Assignment Operator

%= divides a variable by the value of the right operand and assigns the remainder to the variable.

Logical AND

&& Used to compare and only execute the following statement or block of statements if both the left and right condition values are true.

Multiplication Operator

*

Exponentiation operator

** returns the result of raising the first operand to the power of the second operand.

Exponential Assignment Operators

**= raises the value of a variable to the power of the right operand and assigns the result to the variable.

Multiplication Assignment Operator

*= multiplies a variable by the value of the right operand and assigns the result to the variable.

Addition Operator

+

shorthand notation to add 1

++num or num++

Addition Assignment Operator

+= this operator adds the value of the right operand to a variable and assigns the result to the variable. The types of the two operands determine the behavior of the addition assignment operator strings concatenate numbers add and assigns the result to the variable.

Subtraction Operator

-

Subtraction

- symbol used to take away one number from another to get a smaller number.

shorthand notation to decrease by 1

--num or num--

Subtraction Assignment Operator

-= subtracts the value of the right operand from a variable and assigns the result to the variable.

Division Operator

/ produces the quotient of its operands where the left operand is the dividend and the right operand is the divisor.

Division Assignment Operator

/= divides a variable by the value of the right operand and assigns the result to the variable.

less than operator

< Returns true if left value is less than the right value else false is returned.

less than or equal to operator

<= Returns true if left value is less than or equal to the right value else false is returned.

Equality operator

== operator checks whether its two operands are equal, returning a Boolean result of true or false. Unlike the strict equality operator(===) , it attempts to convert and compare operands that are of different types.

Strictly Equal - comparison operator

=== checks whether its two operands are equal, returning a Boolean result of either true or false. Unlike the equality operator (==), the strict equality operator always considers operands of different data types to be different.

greater than operator

> Returns true if left value is greater than the right value else false is returned.

greater than or equal to operator

>= Returns true if left value is greater than or equal to the right value else false is returned.

nullish operator

?? is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand - left expression ?? right expression

ternary operator

A quick, single line if / else statement.

Assignment Operators

All the types of these operators assign a value to its left operand based on the value of its right operand *=, **=, /=, *=, %=, +=, -=,

conditional operator

An alternate way (short cut) to coding an if-else statement using three operands where a condition followed by a question mark (?), then an expression to execute if the condition is true (truthy) by a colon (:), and finally the expression to execute if the condition is false(falsy). (condition ? ifTrue : ifFalse)

post-increment operator

The ++ operator when it is applied after a numeric variable. Increments the value of the numeric variable by 1 and returns the original value.

pre-increment operator

The ++ operator when it is applied before a numeric variable. Increments the value of the numeric variable by 1 and returns the new value.

post-decrement operator

The -- operator when it is applied after a numeric variable is used and decrements the value of the numeric variable by 1 and returns the original value.

Pre-decrement Operator

The -- operator when it is applied before a numeric variable and decrements the value of the numeric variable by 1 and returns the new value.

Binary Logical Operators

These operators (&, ||, ??) typically used with boolean (logical) values, and when they are, they return a Boolean value of either true or false.

in operator

This operator returns true if the specified property is in the specified object or array value set.

Boolean values

True or False

tyepof operator

Use to find the data type of a JavaScript variable

instance of operator

Used to check the type of an object at run time. It returns a Boolean value of true then it indicates that the object is an instance of a particular class and if false then it is not.

Relational Operators

Used to compare two values. Operators include =,<,>,<=,>=,<>, in and instance of. They evaluate to either true or false.

Boolean Expression

in programming, an expression that evaluates to True or False.

NaN

not a number

null

nothing

unary operator

operator with only one operand( ++, --)

ternary operator syntax

result = val1 _(comparison operator)___ val2 ? __(true) statement______:___(false) statement______. Ex: result = val1 < val2?"less than":"greater than or equal to";

in operator

used to determine if a value is found in an array or object. Returns true is found and false if not found.

Loosely Typed Language

A coding language where the user does not need to specify a data type when declaring variables. Python and JavaScript are loosely typed languages.

Strictly unequal - Nonidentity (not) operator

!== checks whether its two operands are not equal, returning a Boolean result of either true or false. Unlike the inequality operator(!=), the strict inequality operator always considers operands of different types to be different.


Set pelajaran terkait

PHAR 253: Medications for Depression:

View Set

Chapter 1 Questions: Basic insurance concepts and principals

View Set