JavaScript-daky IIFE-daky aýlawly ýaýlalar
Adatça, bir wagtda çagyrylýan funksiýany çagyrmakda + belgisi ýerine aýlawly ýaýlalar ulanylýar, sebäbi beýle bir görnüş has aýdyň hasap edilýär:
javascript(function() {
console.log('!');
}());
Köp ýagdaýda, funksiýany çagyrmak üçin aýlawly ýaýlary daşarda şeýle goýýarlar:
javascript(function() {
console.log('!');
})();
Задание 1
Kody işletmezden öň, konsolda näme çap ediljekdigini kesgitläň:
javascriptlet result = (function() {
return '!';
}());
console.log(result);
Задание 2
Kody işletmezden öň, konsolda näme çap ediljekdigini kesgitläň:
javascriptlet result = (function() {
return '!';
})();
console.log(result);
Задание 3
Kody işletmezden öň, konsolda näme çap ediljekdigini kesgitläň:
javascriptlet result = (function() {
return '!';
});
console.log(result);
Задание 4
Kody işletmezden öň, konsolda näme çap ediljekdigini kesgitläň:
javascriptlet result = (function() {
return '!';
});
console.log(result());