Author: Saim Khalid
-
Yield Operator
JavaScript Yield Operator The yield operator in JavaScript is used to pause and resume the generator function asynchronously. In JavaScript, generator functions are the special functions that you can pause or resume while executing. The generator functions are defined with the ‘function*’ syntax. The yield keyword can only be used within the generator function that contains it. The yield operator pauses…
-
Grouping Operator
JavaScript Grouping Operator The grouping operator in JavaScript controls the precedence of the evaluation in expressions. It is denoted by parenthesis (), and you can put the expression inside that to change the expression evaluation order. It helps to evaluate an expression with lower precedence before an expression with higher precedence. Syntax You can follow the syntax…
-
Comma Operator
JavaScript Comma Operator The comma operator (,) in JavaScript evaluates the multiple expression from left to right. You can use the resultant value of the left expression as an input of the right expression. After evaluating all expressions, it returns the resultant value of the rightmost expression. However, the comma operator is also used in the ‘for’…
-
Delete Operator
JavaScript Delete Operator The JavaScript delete operator deletes/ removes a property from an object. It removes the property as well as value of the property from the object. It works only with the objects not with the variables or functions. In JavaScript, an array is an object, so you can use the ‘delete’ operator to…
-
Safe Assignment Operator
JavaScript Safe Assignment Operator (?=) is a suggested new feature for JavaScript that makes it easier to handle errors in code. This operator helps developers deal with errors more simply, without having to use complicated try/catch blocks. It is denoted by (?=) symbol. It is currently under development and not yet part of the official ECMAScript specification. Syntax The…
-
Nullish Coalescing Operator
Nullish Coalescing Operator The Nullish Coalescing operator in JavaScript is represented by two question marks (??). It takes two operands and returns the first operand if it is not null or undefined. Otherwise, it returns the second operand. It is a logical operator introduced in ES2020. In many cases, we can have the null or empty values stored in the…
-
typeof Operator
The typeof Operator The typeof operator in JavaScript is a unary operator used to get the data type of a particular variable. It is placed before its single operand, which can be of any type. Its returns a string value indicating the data type of its operand. JavaScript contains primitive and non-primitive data types. There are seven…
-
Conditional Operators
JavaScript Conditional Operators The conditional operator in JavaScript first evaluates an expression for a true or false value and then executes one of the two given statements depending upon the result of the evaluation. The conditional operator is also known as the ternary operator. The JavaScript conditional (ternary) operator is only operator that takes three operands a condition followed…
-
Assignment Operators
JavaScript Assignment Operators The assignment operators in JavaScript are used to assign values to the variables. These are binary operators. An assignment operator takes two operands, assigns a value to the left operand based on the value of right operand. The left operand is always a variable and the right operand may be literal, variable or expression. let x =10;// right operand is a…
-
Bitwise Operators
JavaScript Bitwise Operators The bitwise operators in JavaScript perform operations on the integer values at the binary level. They are used to manipulate each bit of the integer values. Bitwise operators are similar to logical operators but they work on individual bits. JavaScript bitwise operators works on 32-bits operands. In JavaScript, numbers are stored as…