Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Need clarity regarding LET and temporal dead zone
console.log(a);

let a = 10;
var b = 100;

Output:
script.js:1 Uncaught ReferenceError: Cannot access 'a' before initialization

let a;
console.log(a);
a = 10;
console.log(a);

Output:-
undefined
10

Doubt:- While performing the first console.log(a), a is in temporal dead zone since it hasn't been initialized. So why is it not throwing any error and printing undefined?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Because you have defined the variable but not the content

in the first example the variable is defined after is called so it throw an error

in the second case the variable is defined but it's content doesn't. So the first console.log print the content undefined

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!