Create IIFE examples

This commit is contained in:
LSvekis 2021-07-01 19:59:51 -04:00 committed by GitHub
parent 7db9f71e0e
commit 5149293f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

17
Chapter 12/IIFE examples Normal file
View File

@ -0,0 +1,17 @@
let val = '1000';
(function () {
console.log('hello');
let val = '100'; // local scope variable
})();
let result = (function () {
let val = 'Laurence';
return val;
})();
console.log(result);
console.log(val);
(function (val) {
console.log(`My name is ${val}`);
})('Laurence');