ife in javascript code example
Example 1: immediately invoked function expression
(function () {
statements
})();
Example 2: immediately invoked function expression
(function () {
var aName = "Barry";
})();
// Variable aName is not accessible from the outside scope
aName // throws "Uncaught ReferenceError: aName is not defined"
Example 3: using if statements in javascript
if (expression) {
Statement(s) to be executed if expression is true
} else {
Statement(s) to be executed if expression is false
}