Javascript Beginning!

We going to see the building blocks of javascript and following topics are covered as follows,

  • Variables

  • Scope

  • Hoisting
  • Functions
  • IIFE (Immediately Invoking Function Expression)
  • Closure
  • This Identifier
  • Prototyping
  • Modules
  • Polyfill
  • Transpiling
1. Variables

Variables are the placeholder where we can hold the values and in Javascript we can have multiple values since the values has type, there are following value types available as follows,

1. string
2. boolean
3. null
4. undefined
5. object
6. symbol

it will be one of the above types for all the values.

Variable Declaration: var a; // a is variable to hold values

2. Scope

Scope is a collection of variables and set of rules for how to access the variable with name.

3. Hoisting

whenever a variable declared with var keyword then technically it moved to top of the enclosing scope.

console.log(a); // a is hoisted var a = 30;

4. Functions

Functions are special type of values and it primary factor for scopes. which has following syntax

// named function declaration function a() { } // anonymous function declaration var x = function () { }

Names function declaration is preferred