Now let our locally called function doesn't
display something to the console, but
returns it via return
:
+function() {
return '!';
}();
Let's assign the result of our function to a variable and print it to the console. Since in this case there is an assignment to a variable, the plus is no longer needed:
let result = function() {
return '!';
}();
console.log(result); // shows '!'
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());