Category JavaScript

Conditional Operator in JavaScript

Example of conditional or ternary operator in javaScript

Conditional operator in JavaScript provides a one line approach for creating a simple conditional statement. It is often used as a shorthand method for if-else statement. It makes the code much more simple, shorter and readable. The conditional operator (?:)…

Logical Operators in JavaScript

Logical operators in JavaScript are those operators which are used to form compound conditions by combining two or more simple conditions or relations. In other simple words, logical operators combine the comparison into one condition group. It is useful when…

Comparison Operators in JavaScript

Comparison operators in JavaScript are those operators that are used for comparing between two numeric values, strings, objects, or two quantities. The comparison operators determine the relationship between them by comparing operands (or values). Therefore, we also know the comparison…

Assignment Operator in JavaScript

An operator that is used to assign/update the value of a variable is called assignment operator in JavaScript. The most common assignment operator is equal operator “=”, which assigns the right-hand value to the left-hand variable. The general syntax is…

Operators in JavaScript: Types, Example

Operator sub-types in JavaScript

Operators in JavaScript are very similar to the operators that appear in the other programming languages, such as C++, or Java. The definition of an operator is simply a symbol that tells the interpreter (or compiler) to perform a certain…