DEV Community

PUSHAN VERMA
PUSHAN VERMA

Posted on

2 1

Hoisting and Temporal Dead Zone

Hoisting

console.log('varname',varName);
var varName;
console.log('varname',varName);
varName ="captain america";
console.log('varname',varName);

fn();
function fn()
{
console.log("hello from fn");
}
fn();

Image description

Temporal Zone

//temporal dead zone is a zone where the variable is in accesible

with var
console.log(a);
var a =2;
op-undefined

with let
console.log(b);
let b=3;

op -(Error ) Missing initializer in const declaration

with const
console.log(c);
const c=4;

op -(Error ) Missing initializer in const declaration

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video