(function(i){
console.log(i)
})(i);
This is what is known as a self-executing anonymous function, or a function that you don't have to give a name. It's also executed immediately after being defined. If you look at the first set of parentheses, they wrap the function keyword, argument list, and function defintion, while the second set of parentheses are where you pass in your argument.
/* self-executing anonymous function definition */
( function(i){
console.log(i)
}
)
/* pass argument i into the anonymous function and execute */
(i);
I split this up a little more with whitespace so that it's easier to break it down visually.
Now, because the function parameter and the argument have the same name, the definition may be confusing to someone seeing this for the first time. So here's that same example, except let's just pass in an actual value into the function:
(function(i){
console.log(i) // prints '5'
})(5);