Javascript IIFE Functions
IIFE stands for immediately invoked function expression
These functions are used to define variables ,functions with local scope.
When many people work on a same codebase they may use same function name unknowingly which may give rise unwanted code linking.
So this feature of javascript removes that boundary and allows user to define their variable/functions in local scope which does not have any global effect if they are similarly named with any global function or variable.
A sample expression would be
(function (a,b){
function sum() {
let a,b;
return (a+b);
}
})(5,6);
Top comments (1)
(function (a,b){
function sum() {
let a,b;
return (a+b);
}
})(5,6);
You missed ")"