let & const in JS 🔥Temporal Dead Zone | | Namaste JavaScript Ep. 8

preview_player
Показать описание
let & const in JavaScript behave differently when they are Hoisted. Understanding the difference between var, let and const in JS will help you write better code. const and let are in a Temporal Dead Zone until they are initialized some value. You might encounter SyntaxError, TypeError or ReferenceError while using them in your code.

This JavaScript tutorial video covers everything in depth about how let and const are hoisted and how let in js is different from var and const in JS. We will also see what happens behind the scenes in the browser when you use them in code. Another exciting part of the video is the explanation of the difference between Syntax Error, Reference Error, and Type Error in JavaScript.

00:00 - Introduction
00:16 - Hoisting of let & const in JavaScript
00:53 - Code example of let declaration hoisting in JS
02:45 - Behind the Scenes of let & const hoisting in browser
05:29 - Temporal Dead Zone in JavaScript
07:44 - Reference Error explained in depth
09:18 - Relation of global object and variables var, let & const
10:54 - Duplicate redeclaration of let and const variables
12:39 - Important Difference between let and const
13:56 - Syntax Error in JavaScript
14:54 - Type Error in JavaScript
15:11 - Difference between SyntaxError vs TypeError vs ReferenceError
17:52 - Difference between var, let or const?
19:00 - How to avoid Temporal Dead Zone
20:07 - Interview Question - Hoisting of let & const
20:24 - Teaser - Diving deep into Block Scope of let & const
21:07 - Thank you for watching Namaste JavaScript 🙏

Support this video series, NOT BY MONEY, but by sharing it with your friends. 🙏
I'll give my best to come up with great content and everything absolutely for free on YouTube. 😊

If you are active on Social Media,
please give a shoutout to Namaste JavaScript and help me reach more people. 🙏

Cheers,
Akshay Saini

Would love to Stay Connected with you ❤️

#NamasteJS #AkshaySaini
Рекомендации по теме
Комментарии
Автор

so many things here. I would like to sum up in notes,

-> let and const are hoisted. we cant use them before initialization is result of "temporal dead zone".
-> js use diff memory than global execution context to store let and cost. which is reason behind "temporal dead zone"
-> level of strictness ... var<<let<<const.
-> var //no temporal dead zone, can redeclare and re-initialize, stored in GES
let //use TDZ, can't re-declare, can re-initialize, stored in separate memory
const //use TDZ, can't re-declare, can't re-initialize, stored in separate memory
-> syntax error is similar to compile error. while type and reference error falls under run time error.
-> syntax error ... violation of JS syntax
type error ... while trying to re-initialize const variable
reference error ... while trying to access variable which is not there in global memory.

parthajagiya
Автор

I am 3 years of experienced react native developer. I learn JS from many youtubers, udmy plans many more but this is what i was looking for since 3.5 years.
Dear new learner's you can blindly follow this guy. Really a gem 💎

LifepartChandigarh
Автор

Things learned:
1. let and const are hoisted but its memory is allocated at other place than window which cannot be accessed before initialisation.
2. Temporal Dead Zone exists until variable is declared and assigned a value.
3. window.variable OR this.variable will not give value of variable defined using let or const.
4. We cannot redeclare the same variable with let/const(even with using var the second time).
5. const variable declaration and initialisation must be done on the same line.
6. There are three types of error: [1] referenceError {given where variable does not have memory allocation} [2] typeError {given when we change type that is not supposed to be changed} [3] syntaxError {when proper syntax(way of writing a statement) is not used}.
7. Use const wherever possible followed by let, Use var as little as possible(only if you have to). It helps avoid error.
8. Initialising variables at the top is good idea, helps shrinks TDZ to zero.

jagrutsharma
Автор

This is the best charity anyone can give. Thank you for not charging for these videos.

corporatetrainers
Автор

How was this video? Are you feeling excited? Let me know in the comments below. ❤️

akshaymarch
Автор

I failed in around 10 interviews last year but by just going through 4 vedios of yours, I cracked the technical round and got selected. Thank you

poornimank
Автор

Can't believe instead of Netflix I am watching javascript videos in free time...

ruchikasingh
Автор

I really feel proud cos now we don't need to refer any tutorial form foreigner while we have best talent like Akshay. Salute bro.

nareshbhati
Автор

I think I was in " temporal dead zone " until this video was completed 🙏😀🙏

Thank you so much all other concept I learned before strat watching your video made me fell now that I was in "Temporal dead zone".

I really love having these concepts over watching movies and series on Netflix, you making my interest going far and far Brother.
❤️I ALREADY FALL IN LOVE WITH JAVASCRIPT ❤️JUST BECAUSE OF YOU BROTHER period.

VikashKumar-oxhv
Автор

I have been studying these concepts for the past few weeks and was already starting to feel stuck, until I found your videos by chance. His explanation is impeccable. I'm following this playlist firmly. Thanks!

renatoalves
Автор

Basically am a java developer I never really liked js, but u just made me start loving it... ಧನ್ಯವಾದಗಳು❤️

brahmanandas
Автор

I guess if u take any JS interview then nobody in this world would get hired .Absolutely amazing tutorials bro .Keep going 😊😊😊

SameeraPkChannel
Автор

Without watching video first I like the video
Always love ur video with good information

shreedevijamakhandi
Автор

i was really confused about let and const hoisting when my trainer asked me. And your video explained everything about it . Now am confident about these concepts. Thank you namasthe js

chandanabr
Автор

I have been studying these concepts last one year but now I understood all Advance JS concepts through visualization . Thanks . your efforts are appreciable .

shaileshkamble
Автор

Dude...You nailed it.. Itna acha clear explaination bhi JS k videos dekhe usme se tumhare video k level ka koi bhi nai match kr paya.

jyotipatnaik
Автор

I have never come across such high-quality content on JS. Thanks for digging so deep.

deepjyotkaurbindra
Автор

Seriously you are very good at explaining the difficult concepts with live examples

ASeaker
Автор

i am addicted to this series! Can't wait for next one! Making notes with every episode :)

aayush
Автор

That explanation and coding demo of ReferenceError, TypeError, SyntaxError was amazing

stark
welcome to shbcf.ru