study

A diary of some sort. An interesting one.

Into Javascript


var nameTag = 69;

typeof(nameTag); // > Outputs "number"


var a = 1, b = 2, c = 3;

if (b>a) {
    let c = 5;
    console.log(c);
} //> outputs 5 

console.log(c); //> outputs 3


(function someFunction() {
    
    // ... some code ...

})();

The important thing to note there is the presence of parenthesis wrapping the function statement another another set of parenthesis immediately after the statement.
The function above operates identical to:


function someFunction() {

// ... some code ...

}

someFunction();

Functions declared following the above format are referred to as Immediately Invoked Function Expressions (IIFEs).