⊗jsPmFCRB 268 of 504 menu

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:

(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());
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline