iife (immediately invoked function expression)
Предварительный просмотр (5 стр.)
Прокрутите вниз 👇
О "iife (immediately invoked function expression)"
tutorial 3: iife, context, new 3.1 iife (immediately invoked function expression) an iife is a function that runs as soon as it is defined. it helps avoid polluting the global scope by encapsulating code. (function () { let secret = "this is hidden"; console.log(secret); // output: this is hidden })(); // console.log(secret); // error: secret is not defined real-world example : initializing a library or module without exposing internal variables. (function () { let apikey = "12345"; function getapikey() { return apikey; } console.log(getapikey()); // output: 12345 })(); 3.2 context (this) the this keyword refers to the context in which a function is called. its value depends on how the function is invoked. 3.2.1 implicit binding when a function is …
Этот файл содержит 9 стр. в формате PPTX (231,1 КБ). Чтобы скачать "iife (immediately invoked function expression)", нажмите кнопку Telegram слева.