Difference between an array and an object in JS

“Everything”  in JavaScript is an Object… Even primitive datatypes (except null and undefined) can be treated as objects. The Array object is used to store multiple values in a single variable. An object is just a special kind of data, with properties and methods. The difference is that Arrays are numerically indexed data, while Objects

Hoisting in Javascript

This is an interesting feature of Javascript known as hoisting, because it is as if Javascript is “hoisting” (which means to move up) the variable declaration to the top of the function. // global variable var testVar = "I'm a global"; function example( ) { alert(testVar); //what does this line alert? /*local variable with same name as the