()
is a grouping operator, and it returns the result of evaluating the expression inside it.
So while
> function(x,y) {}
SyntaxError: Unexpected token (
by itself is a SyntaxError
, but by surrounding it in parentheses, the expression inside the parentheses is evaluated and returned.
> (function(x,y) {})
function (x,y) {}
Function expressions and declarations do not yield any value, so we get undefined
as a result.
Function Declaration
> function a(x,y) {}
undefined
Function Declaration (with grouping operator)
(function a(x,y) {})
function a(x,y) {}
Function Expression
> var x = function(x,y) {}
undefined
Function Expression (with grouping operator)
> var x;
> (x = function(x,y) {})
function (x,y) {}
However, the usage in your example seems to be useless. It does nothing.