Posts
Showing posts from April, 2024
JS interview Questions -Piyush Garg
- Get link
- X
- Other Apps
// console.log("Value of Age is",age); // var age=2 // console.log("Value of Age is",age); /** * undefined * 2 * * Because of Hoisting * Global execution context * Memory phase --> js will traverse whole code and it will load that in memory phase * code phase * */ // age =100; // console.log("Value of age is",age); // let age =30; /** * Throw reference Error * trying to acess age before initialization * * let and const are hoisted differently * they are hoisted inside Temporal Dead Zone *the area of a block where a variable is inaccessible until the moment the computer completely initializes it with a value. */ // myFun(); // var myFun = function(){ // console.log('First') // } // myFun(); // function myFun(){ // console.log('Second'); // } // myFun(); /** * Second * * First * * First ...