() 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.
(function (h,j) { })doesn't do anything.(function (h,j) { })(arg1,arg2)creates and executes an anonymous function. Notice the difference is the parentheses after the first part - just like sayingalertvs.alert(), one mentions a function, the other executes it.