(function f() {
// do something
}());
vs
(function g() {
// do something
})();
Note the position of the ending parentheses.
- Do these execute in the same manner?
- Do they restrict the scope of variables differently?
(function f() {
// do something
}());
vs
(function g() {
// do something
})();
Note the position of the ending parentheses.
They are the same. Just two notations to do the same thing. Some people find one notation more intuitive than the other. Just a matter of preference, nothing more than that.