Logical Operators in JavaScript
Logical Operators
Logical Operators, also known as Boolean Operators, evaluate an expression and return true or false.
The list of three logical operators are:-
Logical Operator | Description |
&& | True if both values are true |
|| | True if only one value is true |
! | Returns true if value is false, else return false if value is true |
Ternary Operator:-
Conditional, or Ternary, operators assign a value to a variable, based on some condition.
Ternary Operator Syntax:-
Its simple syntax is:- variable = (condition) ? value1: value2
For your Information:-
In other words, if the condition is true, then value1 will be assigned otherwise value2 will be assigned.