Javascript

Logical Operators in JavaScript

The Logical operators operate on a set of operands and return one of the operands as a return value. It is typically used on boolean operands, in which case the return value is a boolean. If the operands and not boolean values, then logical operators may return a non-boolean value. JavaScript has four logical operators. They are AND (&& ), OR ( || ) , NOT (!) & Nullish coalescing operator (??).

Logical Operators in JavaScript Read More »

Ternary Conditional Operator in JavaScript

The JavaScript conditional operator is a Ternary Operator, which takes three operands. The first operand is condition to evaluate. It is followed by a question mark (?), then an expression (expression1). It is then followed by a colon (:) and second expression (expression2). If the condition is true, then expression1 executes & if the condition is false, then expression2 executes. The conditional operator is a shorthand way to write an if-else statement.

Ternary Conditional Operator in JavaScript Read More »

Scroll to Top