Parentheses in IIFE in JavaScript
Normally, parentheses are used instead of plus when calling a function in-place, because this style is considered more obvious:
javascript(function() {
console.log('!');
}());
Most often, the parentheses of a function call are placed outside, like this:
javascript(function() {
console.log('!');
})();
Задание 1
Determine what will be output to the console without running the code:
javascriptlet result = (function() {
return '!';
}());
console.log(result);
Задание 2
Determine what will be output to the console without running the code:
javascriptlet result = (function() {
return '!';
})();
console.log(result);
Задание 3
Determine what will be output to the console without running the code:
javascriptlet result = (function() {
return '!';
});
console.log(result);
Задание 4
Determine what will be output to the console without running the code:
javascriptlet result = (function() {
return '!';
});
console.log(result());