Front-End/javascript/Javascript Expert/chapter10/ImmediatelyInvokedFunctionExpression.js

12 lines
456 B
JavaScript

// const runOnce = function () {
// console.log("This will never run again");
// };
// eine solche Methode kann man nicht manuel ausführen, sie wird noch einmal bei dem Laden des Scripts ausgeführt
// Ideal für die ursprünglichen Einstellungen der Resourcen einer WEB-Applikation (IIFE-Immediatelly Invoked Function Expression)
(function () {
console.log("This will never run again");
})();
() => console.log("This will also never run again")();