in JavaScript by
Q:
What is a Temporal Dead Zone?

1 Answer

0 votes
by

Temporal Dead Zone is a behaviour that occurs with variables declared using let and const keywords.

It is a behaviour where we try to access a variable before it is initialized.

Examples of temporal dead zone:

x = 23; // Gives reference error

let x;

function anotherRandomFunc(){

  message = "Hello"; // Throws a reference error

  let message;

}

anotherRandomFunc();

In the code above, both in global scope and functional scope, we are trying to access variables which have not been declared yet. This is called the Temporal Dead Zone .

Click here to read more about JavaScript
Click here to read more about Insurance

Related questions

+1 vote
asked Jul 17, 2020 in Other by RShastri
0 votes
asked Mar 6, 2020 in Agile by rahuljain1
0 votes
asked Jan 15, 2020 in Angular by rahuljain1
0 votes
asked Mar 13, 2020 in JavaScript by Tate
+1 vote
asked Dec 4, 2019 in JavaScript by SakshiSharma
0 votes
asked Feb 29, 2020 in JavaScript by RShastri
...