A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/javascript-operators-reference/ below:

JavaScript Operators Reference - GeeksforGeeks

JavaScript Operators Reference

Last Updated : 04 Jul, 2024

JavaScript Operators are used to perform specific mathematical and logical computations on operands. In other words, an operator operates the operands. In JavaScript, operators are used to compare values, perform arithmetic operations, etc.

Example: In this example, we will use typeof operator to check the type of variable.

JavaScript
let a = 17;
let b = "GeeksforGeeks";
let c = "";
let d = null;

console.log("Type of a = " + (typeof a));
console.log("Type of b = " + (typeof b));
console.log("Type of c = " + (typeof c));
console.log("Type of d = " + (typeof d));
console.log("Type of e = " + (typeof e));

Output
Type of a = number
Type of b = string
Type of c = string
Type of d = object
Type of e = undefined

The Complete List of JavaScript Operators is listed below:

JavaScript Arithmetic Operators

These are the operators that work on numerical values and then return a number. These are basically used to perform mathematical operations.

JavaScript Comparison Operators

These are the operators that are used to perform equality or difference comparisons between the values. It checks whether an element is greater, smaller equal, or unequal to the other element.

JavaScript Logical Operators

These are the operators which allow us to compare variables or values. The logical operator is mostly used to make decisions based on conditions specified for the statements. It can also be used to manipulate a boolean or set termination conditions for loops.

OPERATOR NAME OPERATION NOT (!) Converts operator to boolean and returns flipped value. AND (&&) Evaluates operands and return true only if all are true. OR (||) Returns true even if one of the multiple operands is true. JavaScript Bitwise Operators

These operators convert the number to a 32-bit binary number and perform the bitwise operation. The number is converted back to the 64-bit number after the result. 

JavaScript Assignment Operators

These operators assign the value of the right-hand operand to its left-hand operand. That is if a = b assigns the value of b to a.

Few Important JavaScript Operators OPERATOR NAME OPERATION Ternary (?:) Used as a simplified version of if-else to reduce code lines. typeof  A keyword to return the data type of the operand. conditional Used to perform operations according to conditions. instanceof Used to check the type of operator at runtime. Delete Used to delete JavaScript object properties. in  Keyword used to check if a property exists or not. Spread (...) A new feature is used to expand iterables in form of an array. comma (,) Used to separate operands. Grouping Used to override normal operator precedence. Unary (+_)  Converts the type of variable to the number. Short circuiting Used for evaluating an expression. Nullish Coalescing (??)  Used to return a value if the value is undefined or null. Unsigned right bit shift (>>>) Used as unsigned right bit shift operator. Pipeline (|>) Used to pipe the value of an expression to function. Optional chaining (?.) Error-proof way to access nested object properties. Arrow Shortcut way of writing a function.

To learn about the precedence of these operators check this article Operator precedence in JavaScript



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4