The grouping operator consists of a pair of parentheses around an expression or subexpression to override the operator’s normal precedence so that expressions with lower precedence can be evaluated before another expression which has a higher priority. This operator can only contain expressions.The list of parameters is passed to a function in this operator, which treats it as an expression.


( )

This ( ) operator controls the precedence of evaluation in expressions.

Example 1: Below is an example of the Grouping operator. 


function gfg() {
// 3 * (2 + 3)
let value1 = 3 * (2 + 3);
// (3 + 2) * 3
let value2 = (3 + 2) * 3;



Example 2: Function Works as both a statement and an exception. In the code below, JavaScript considers a function to be a statement if it is not preceded by any other statement. But applying the grouping operator which has the highest precedence over any other operator treats the function as an expression and is therefore fully evaluated.


function(x) { return x };
// SyntaxError: Function statements
// require a function name.
// function as expression
(function (x) { return x });
// This will run without any exception.


Uncaught SyntaxError: Function statements require a function name

Example 3: With and without grouping operator. 


function gfg() {
// 5 * 5 + 5
// 25+5
// 30
let value = 5 * 5 + 5;
console.log("Without grouping operator: " + value);
// 5 * (5 + 5)
// 5*10
// 50
let value1 = 5 * (5 + 5);
console.log("With grouping operator: " + value1);


Without grouping operator: 30
With grouping operator: 50

We have a complete list of JavaScript Operators, to check those please go through theJavaScript Operators.

Supported Browser:

  • Chrome 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Internet Explorer 3 and above
  • Opera 3 and above
  • Safari 1 and above
Whether you are preparing for your first job interview or planning to improve your skills in this ever-evolving tech landscape,CodeConfig.inCourses will help you in achieving success. We provide top-quality content onJavaScriptatno cost, all geared towards accelerating your growth in the limited time period. Join the millions we have already helped, and we are here to do the same for you. Don’t miss out – check it out now!
Please Check all JavaScript articles HERE. For more such post you can refer HERE.

Explore More

How to Center a Popup Window on Screen

JavaScript method is used to open a popup window. This popup window will be placed in the center of the screen. This example creates the pop-up window without placing it into

How to hide URL in the popup window opened using

If you are using below code to open a popup window in your web page, then address must be appearing in you pop up window and f you want to

window.showModalDialog is deprecated in Edge and Chrome

If you have a website being compatible with Edge/Chrome and in past it was only compatible with IE 11 and if you are using window.showModalDailog in your JavaScript code, then