Normally, parentheses are used instead of plus when calling a function in-place, because this style is considered more obvious:
(function() {
console.log('!');
}());
Most often, the parentheses of a function call are placed outside, like this:
(function() {
console.log('!');
})();
Determine what will be output to the console without running the code:
let result = (function() {
return '!';
}());
console.log(result);
Determine what will be output to the console without running the code:
let result = (function() {
return '!';
})();
console.log(result);
Determine what will be output to the console without running the code:
let result = (function() {
return '!';
});
console.log(result);
Determine what will be output to the console without running the code:
let result = (function() {
return '!';
});
console.log(result());