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

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ม.ค. 2025

ความคิดเห็น • 1.2K

  • @LifepartChandigarh
    @LifepartChandigarh 10 หลายเดือนก่อน +36

    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 💎

  • @parthajagiya4439
    @parthajagiya4439 3 ปีที่แล้ว +777

    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

    • @surajpatil3247
      @surajpatil3247 3 ปีที่แล้ว

      thanks

    • @surajpatil3247
      @surajpatil3247 3 ปีที่แล้ว

      @Akshay Saini pin this comment

    • @deependrakumar2019
      @deependrakumar2019 3 ปีที่แล้ว +44

      Just one correction let variable can be reinitialize.

    • @karljosebuena
      @karljosebuena 3 ปีที่แล้ว

      @@deependrakumar2019 thanks for the notes :)

    • @nikhil4844
      @nikhil4844 3 ปีที่แล้ว

      Thank you

  • @jagrutsharma9150
    @jagrutsharma9150 2 ปีที่แล้ว +558

    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.

    • @omkarmankar1524
      @omkarmankar1524 2 ปีที่แล้ว +1

      Very Good Explaination

    • @rajendrasinghbisht5119
      @rajendrasinghbisht5119 2 ปีที่แล้ว +4

      Awesome Summary just like the video

    • @robertobenedit
      @robertobenedit 2 ปีที่แล้ว +1

      Bravo!

    • @gulz4u
      @gulz4u 2 ปีที่แล้ว +9

      @vipin here you are re initializing it and that is allowed in let but you cannot redeclare the same variable again. I hope this was what you were looking for.

    • @siddeeqsiddi7829
      @siddeeqsiddi7829 2 ปีที่แล้ว +10

      @@gulz4u let variable value can change without using let word again
      eg: let a=10;
      a=20;

  • @corporatetrainers3286
    @corporatetrainers3286 4 ปีที่แล้ว +105

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

  • @ruchikasingh9220
    @ruchikasingh9220 4 ปีที่แล้ว +708

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

    • @vitalvisions4U
      @vitalvisions4U 3 ปีที่แล้ว +19

      Same. Had plans for RAY on this weekend. Ending up watching 5 videos of this series.

    • @mizanur_sajid
      @mizanur_sajid 3 ปีที่แล้ว +4

      surely with no credit card 😬

    • @stevenedwards9262
      @stevenedwards9262 3 ปีที่แล้ว +9

      Much more valuable use of your time, id say

    • @hellonishant
      @hellonishant 3 ปีที่แล้ว +2

      same here

    • @valp_co
      @valp_co 3 ปีที่แล้ว +3

      This playlist is pure gold

  • @nareshbhati7527
    @nareshbhati7527 3 ปีที่แล้ว +31

    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.

  • @akshaymarch7
    @akshaymarch7  4 ปีที่แล้ว +91

    Next Video: let & const Block Scope and Shadowing in JS 🔥 - th-cam.com/video/lW_erSjyMeM/w-d-xo.html
    How was this video? Are you feeling excited? Let me know in the comments below. ❤️

    • @codepractices7
      @codepractices7 4 ปีที่แล้ว

      Sir can you tell these videos are Beginners who wanna crack Js interviews or for those who just want to understand Js for web development and pickup any Js framework with ease? I just wanna know the target audience. Btw love the explanations!🙏

    • @ravipanchalvishwakarma
      @ravipanchalvishwakarma 4 ปีที่แล้ว +2

      plz Bhaiya jaldi jaldi videos upload kijiye ... i m so excited to learn JS properly.

    • @ayushjain7658
      @ayushjain7658 4 ปีที่แล้ว

      Hi Akashay , do interviewer ask about design pattern ? How important they are for a senior js developer and can you please upload something on design pattern .
      They are so confusing ..
      It will be a great .
      Thank you sir for your work i am following you from last one year your first vedio is the pivot point in my career

    • @dhanushikavlogs
      @dhanushikavlogs 4 ปีที่แล้ว +2

      Everytime see your video always learn something new... like in this video temporal dead zone.
      You are doing good work keep it up.
      Big big big thanks from my side.😍

    • @sauravkumarsharma9428
      @sauravkumarsharma9428 4 ปีที่แล้ว +1

      Sir one request please try to complete this series by November end if possible it will be very benifitial for me for my placement interviews as you cover everything in very detailed way which is not available anywhere else

  • @poornimank3672
    @poornimank3672 ปีที่แล้ว +27

    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

    • @tusharikatejaswi5117
      @tusharikatejaswi5117 8 หลายเดือนก่อน +7

      if you donot mind mentioning those 10 faileinterview company names, we will apply now??

    • @mohammedkhan6277
      @mohammedkhan6277 2 หลายเดือนก่อน

      Package?

  • @renatoalves92
    @renatoalves92 4 ปีที่แล้ว +93

    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!

    • @yupp_harish3936
      @yupp_harish3936 ปีที่แล้ว

      dude namaste js is free or there is paid version also of namaste js??and is this js series complete or incomplete ...is namaste js series a complete series of js topics??

    • @AdityaSharma-gr9sz
      @AdityaSharma-gr9sz หลายเดือนก่อน

      Bro try reading the documentation. It better for you to try exploring yourself and try building projects

  • @mwesigyenicholas7394
    @mwesigyenicholas7394 หลายเดือนก่อน +2

    Sir i cannot thank you enough i am watching this in 2024, as am looking forward to be a full stack JavaScript developer i have been feeling a gap in my Js knowledge am on episode 8, but my Js knowledge has been solidified . Thanks a lot Sir.

  • @brahmanandas1909
    @brahmanandas1909 4 ปีที่แล้ว +51

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

    • @B-Billy
      @B-Billy 3 ปีที่แล้ว +1

      Same here... so much frustration.

  • @VikashKumar-ox2hv
    @VikashKumar-ox2hv 4 ปีที่แล้ว +97

    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.

  • @shaileshkamble8730
    @shaileshkamble8730 2 ปีที่แล้ว +6

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

  • @Kirti-bi2yj
    @Kirti-bi2yj 5 หลายเดือนก่อน +17

    Here is the full notes of the video :
    1. "let" and "const" declarations are hoisted, but they are hoisted very differently from the "var" declarations.
    2. Memory is assigned to "var" declarations, and "var" declarations are always attached to the global object "window". In case of "let" and "const", they are allocated memory in some different memory space other than global space known as "Script", and this is what we call hoisting. The "let" and "const" declarations are not attached to the global object "window". And this is the reason you cannot access these "let" and "const" variables before you have put some value in them.
    3. Temporal dead zone is the time since when "let" & "const" variables were hoisted (set as "undefined") and till it is initialized with some value, the time between these two phenomena's is known as the Temporal Dead Zone. Whenever you try to access a "let" or "const" variable in the temporal dead zone, then it will always give you reference error.
    4. var declarations are always attached to the window object, provided they've been declared in the global scope. let and const declarations are never attached to the window object, as these variables are never stored in the global memory space.
    5. let and const are more strict than var. Re-declaration of let is not allowed in JS. The JS engine will give a syntax error, it is not allowed in the same scope.
    6. How to avoid temporal dead zone?
    Sometimes the temporal dead zone can mess our code as a developer. The best way to avoid the temporal dead zone is to always put your declarations and initializations on the top of the code. So, that as soon as your code starts running, it hits the initialization part at the first, and then you go into the logic, and then you do something with these variables. Otherwise, you'll run into unexpected errors in your code.
    This way we're shrinking the temporal dead zone nearly to zero. We've minimized the TDZ nearly to zero, while moving all the initializations at the top, so that nothing happens before these initializations.

  • @sougandikal6022
    @sougandikal6022 4 ปีที่แล้ว +8

    Temporal dead zone: Time gap between the variables hoisted and its initialization, Understood clearly about it Thank you Akshay Stay blessed :) :)

    • @vishalgoel6323
      @vishalgoel6323 4 ปีที่แล้ว

      Shouldn't it be declaration instead of initialisation ?

    • @paisastocks8363
      @paisastocks8363 2 ปีที่แล้ว

      @@vishalgoel6323 It should be initialisation only.

  • @chandanabr473
    @chandanabr473 2 ปีที่แล้ว +1

    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

  • @deepjyotkaurbindra
    @deepjyotkaurbindra 4 ปีที่แล้ว +3

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

  • @jyotipatnaik336
    @jyotipatnaik336 3 ปีที่แล้ว

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

  • @shreedevijamakhandi1877
    @shreedevijamakhandi1877 4 ปีที่แล้ว +8

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

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +2

      Thank you so much, @Shreedevi. It means a lot. ❤️

  • @rahulsoni292
    @rahulsoni292 3 ปีที่แล้ว +1

    Instead of buying any course i will learn from your videos
    Thanks for sharing such valuable knowledge bhai

  • @aayush5474
    @aayush5474 4 ปีที่แล้ว +20

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

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +8

      Oh, wow! That's great, it's a very good way to remember things. 😇

    • @sriramray4694
      @sriramray4694 4 หลายเดือนก่อน

      kya aap notes send kar sakte hai

  • @aniketshukla8085
    @aniketshukla8085 ปีที่แล้ว

    You have done real autopsy of Javascript. Now things are so so so easy to visualise that i dont have to remember anything.
    Thank You so much!!!

  • @chinmaydas4053
    @chinmaydas4053 3 ปีที่แล้ว +4

    The legend of JavaScript..no one can teach us in such a intricate details in this world..lots of love and respect for you brother 🙏🙏..

  • @baishakhinandi3635
    @baishakhinandi3635 2 ปีที่แล้ว

    As I am a web designer I should have knowledge about all JS frame work but I have less knowledge in JS. But now I falling in love with this after wathich your videos, and practising accordingly.Best teacher ever. Thank you very much

  • @SameeraPkChannel
    @SameeraPkChannel 4 ปีที่แล้ว +140

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

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +42

      Haha, nothing like that brother.. 😅

    • @robingupta7895
      @robingupta7895 4 ปีที่แล้ว +10

      No, Not like that
      I think he will hire the best person...

    • @gajananlimbale670
      @gajananlimbale670 4 ปีที่แล้ว +3

      😂😂

    • @mahimak5736
      @mahimak5736 4 ปีที่แล้ว +29

      We can clear his interview after watching all his videos 🤣

    • @rishitiwari6200
      @rishitiwari6200 3 ปีที่แล้ว +23

      @@mahimak5736 he be like:Mera maal mere ko hi bech rha

  • @ghostrAider98
    @ghostrAider98 ปีที่แล้ว

    Lots to learn from this video. Would like to add a small detail:
    If they(let and const) are declared in a block, they don’t get hoisted at all, they will get memory allocation(not assignment) when their block actually starts during execution phase. Try the function below and notice the memory allocation in dev tools
    function abc(){
    debugger;
    var a=10;
    let b=20;
    const c=30;
    if(true){
    debugger:
    var x=10;
    let y=20;
    const z=30;
    }
    }

  • @sarav-Frontend_Engineer
    @sarav-Frontend_Engineer 3 ปีที่แล้ว +4

    Didn't heard about this terminology "Temporal Dead Zone" before but now I know it and can explain to anybody because of the great Mr.Akshay 😃

  • @stark469
    @stark469 2 ปีที่แล้ว +2

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

  • @adityakini7517
    @adityakini7517 หลายเดือนก่อน +5

    Can u believe that when I was interviewing for a reputed consulting firms (service based) company, the interviewer asked me whether let variables are hoisted or not and I answered with a Yes, he confidently said No and when I tried to explain him about this, we was reluctant to accept and still said that I am wrong. So guys, if you are interviewing for tier 2/3 service based companies, keep it in mind. As the saying goes : "The problem with the world is that the intelligent people are full of doubt, while stupid ones are full of confidence."

    • @Kirti-bi2yj
      @Kirti-bi2yj หลายเดือนก่อน +1

      🥲

  • @rohanrana187
    @rohanrana187 2 ปีที่แล้ว

    No webseries watching , now watching only Namste Javascript Series , Thanks Akshay Saini no one can explain this thing in a very easy manner , learned lots of new things and fundas

  • @dademix
    @dademix 3 ปีที่แล้ว +5

    Boy this stuff is truly amazing and is super valuable! These are the missing parts I never really understood and understanding those concepts makes everything about JavaScript so much easier and clearer.

  • @asishraz6173
    @asishraz6173 3 ปีที่แล้ว +1

    Wowwww.
    LET,
    CONST,
    TEMPORAL DEAD ZONE
    REFERENCE ERROR
    GLOBAL OBJECT
    TYPE ERROR
    SYNTAX ERROR
    Now I am ready for interview.

  • @rhimanshu6288
    @rhimanshu6288 4 ปีที่แล้ว +4

    Bhai bhai bhai.....What a concept clearance man🙌🏻. I took udemy courses of 50hr messed up duration but the core fundamentals are here in just 5 hrs for free. Thats the difference

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +14

      Not everything which is Free is useless ❤️

  • @rajatshrivastava879
    @rajatshrivastava879 3 ปีที่แล้ว +1

    These are insane teaching skills. I have been dropped in 3 interviews bcs of scope output questions. Now, i explain then how sizes are allocated within different scopes.

  • @SemicolonGuy
    @SemicolonGuy 4 ปีที่แล้ว +7

    Watching whole series the second time just before my interview ❤️

  • @ShivamSingh-wy8om
    @ShivamSingh-wy8om 4 ปีที่แล้ว

    Your explanations changed my view point of javascript. . . From hating it i have started loving it.

  • @universal4334
    @universal4334 4 ปีที่แล้ว +23

    Finally got relief 😁 . Daily twice when I woke up I I'll check the channel for new video and when I am going to bed again I I'll do the same . Please upload daily bro 😑😑😑.

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +80

      Apologies brother, I got busy with the festivals and was not able to make new videos.
      Thank you for so much excitement, it motivates me to make more videos quickly. ❤️
      I'm trying my best, but still cannot make one video in a day along with my job. It takes a lot of time to prepare content, then record video, then edit the video and then upload and release it.
      Somtimes, if the video doesn't come out good, I have to reshoot that part. It takes time.
      But I'll try my best to come back as fast as possible.
      Thank you for your support. 😇

    • @imnothing2infinite
      @imnothing2infinite 4 ปีที่แล้ว +1

      @@akshaymarch7 thank you for your efforts, still I will be checking your channel is there any new video ❤️❤️❤️

    • @nike0822
      @nike0822 4 ปีที่แล้ว +1

      @Akshay Saini Love your efforts & yeah it's not easy to dive deep into these concepts and make a video every day! More power to you man! Take care. I'm really liking your way of teaching.

    • @funtoday5415
      @funtoday5415 4 ปีที่แล้ว +1

      Hello @@akshaymarch7, can you please make a video series on backend(.net c#, mvc controller) web development as well . Your explanation is amazing.

  • @tecres9379
    @tecres9379 2 ปีที่แล้ว

    Temporal dead zone is like a coma state , its there but you cannot talk to him, till the time he/she has been given value of life, Great explanation , we all owe you for deep diving into Concepts

  • @dibyendubiswas1998
    @dibyendubiswas1998 4 ปีที่แล้ว +4

    #LovingIt.
    When I read this concept in book, then I am bored but today I am not bored.

  • @fahadpiash1515
    @fahadpiash1515 ปีที่แล้ว

    i have been struggling so many years to fix how things happened behind the screen but now its very clear to me . became a big fan of yours .. thanks a lot .

  • @VipulDessaiBadGAMERbaD
    @VipulDessaiBadGAMERbaD 2 ปีที่แล้ว +4

    Temporal dead zone is the time between the variable scope creation and its initialisation, that is why let,const will throw error when they are put outside of some blocks (i.e. global context which is not lexical), that is why if you just surround let, const with blocks then their scope will be a block scope and its created and then they wont throw error coz now your accessing them after the time of their scope creation

  • @TheDhanush
    @TheDhanush 4 หลายเดือนก่อน

    I came from swift and PHP background and I clearly understand Javascript with you exceptional teaching. Thanks for the videos. Looking forward to other videos.

  • @adabus8779
    @adabus8779 3 ปีที่แล้ว +8

    @4:20 Hey bro! Really enjoying this indepth content for javascript! I just wanted to point out a small error,
    You said that it is not possible to access the let and const declarations before you put some value in them. Well you could access let variables memory space without putting any value in them provided that it precedes the usage of the variables:
    let a;
    console.log(a);
    a=10;
    output=>
    undefined

    • @exodion4173
      @exodion4173 2 ปีที่แล้ว +1

      Good catch.
      Not that this is for let only. For const, since we hv to initialize them during declaration this wont be possible.

    • @ycombinator765
      @ycombinator765 2 ปีที่แล้ว +1

      good catch indeed. I have a tentative explanation.
      what if 'a' that we are accessing is not the one declared with let but the one which we attach to global 'window' object. see.
      console.log(window.a)
      outputs 'undefined' as well.
      here we didn't declare any 'a' with let.

    • @benbrahimilias426
      @benbrahimilias426 ปีที่แล้ว

      @@ycombinator765 exactly, it's like declaring a new variable

  • @hercules2170
    @hercules2170 3 ปีที่แล้ว +1

    You really weren't kidding when you said "Let me tell you something interesting"
    Good stuff..Learned a lot from this video

  • @avikkarmakar6333
    @avikkarmakar6333 2 ปีที่แล้ว +5

    I genuinely appreciate your efforts of making the concepts clear to us.. thank you so much for the series, I'm learning a lot

  • @aryansingh502
    @aryansingh502 2 หลายเดือนก่อน +1

    A minor correction in definition of TDZ 6:46 “The TDZ ends when the variable is declared, not necessarily when it is initialized.” This implies even if line no 3 would have been only let x; then still TDZ would have been ended there itself.

    • @Kirti-bi2yj
      @Kirti-bi2yj หลายเดือนก่อน +1

      No, the definition you're giving is wrong, this is the correct definition :
      In JavaScript, the Temporal Dead Zone (TDZ) is the period between the introduction of a variable declared with let or const and its initialization. During this time, accessing the variable will result in a ReferenceError.

  • @dhawaltiwari6193
    @dhawaltiwari6193 3 ปีที่แล้ว +9

    This tutorial is the best for the beginners, because it laterally makes coding fun!!..........Are you going to make any content on ES6 and react??

  • @priyanshubhardwaj2158
    @priyanshubhardwaj2158 3 ปีที่แล้ว +2

    Bhai kya banda h yar. As promised you're going to make us fall in love with JS by the end of this playlist!

  • @jayjani740
    @jayjani740 4 ปีที่แล้ว +13

    All your videos help me out discover many new things which I could have never figured out by myself at this particular time. Thanks alot, Akshay. 🤩
    DOUBT:
    let and const refer to Script, right! So what's the relation between Script and Window? Because we can reassign values to let objects into the functions defined in Window scope.

  • @grigortamazyan
    @grigortamazyan 3 ปีที่แล้ว

    I'm studying at a Computer Science School, and I told all other students about this channel, Namaste JavaScript ))))

  • @naveenkumarpulikonda1998
    @naveenkumarpulikonda1998 4 ปีที่แล้ว +7

    one of great videos that i have seen on JavaScript, before coming to this channel i was searching on udemy, LinkedIn learning for the best courses, but i found this course, from that day i have never searched for any other course
    Thank you Akshay Saini for wonderful content....🤗🤗🤗
    Try to make some videos on JavaScript logical questions, so that it helps us to understand these concepts in a practical way
    Today I Got my offer letter because of your videos....

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +1

      Wow, Congratulations brother! ❤️

  • @mohdabdulraheem9357
    @mohdabdulraheem9357 4 ปีที่แล้ว +2

    After a long time now I can saw I have the clarity between const, let and var. Thanks for the video.

  • @VIDLIKER
    @VIDLIKER 4 ปีที่แล้ว +6

    Till date..in every interview I have answered to interviewer that var is hoisted and let and const are not hoisted😅....because in youtube and web people told the same🤣....Awesome video Akshay Bhai🤟🤟👍...eagerly waiting for next video

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +4

      I see a lot of people doing that. 😅
      But don't worry, now you know what to answer. 😉

  • @TW-uk1xi
    @TW-uk1xi 10 หลายเดือนก่อน

    The level of understanding you have is mind blowing.

  • @varnikaraghav3781
    @varnikaraghav3781 4 ปีที่แล้ว +4

    Make more videos on js concept for interview perspectives. The way you explain everything was great!

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +1

      Thank you so much, Varnika. Your comment motivates me to make more videos. ❤️

  • @anjalimaurya7598
    @anjalimaurya7598 3 ปีที่แล้ว +1

    every songs in the end of video hear like word namaste javascipt lyrics with superb music tone
    .

  • @shovarajouria110
    @shovarajouria110 4 ปีที่แล้ว +11

    Just a request , after completing this course could you explain how css works in detail ! Amazing content as usual

    • @drafercuber9943
      @drafercuber9943 4 ปีที่แล้ว

      Can I

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +15

      Added to my list, will try to cover that also. 😇

    • @soulseller1838
      @soulseller1838 2 ปีที่แล้ว

      @@akshaymarch7 Is it still on list?

    • @madeinscript4623
      @madeinscript4623 6 หลายเดือนก่อน

      ​@@akshaymarch7sir hope ur list will be made soon

  • @ASeaker
    @ASeaker 7 หลายเดือนก่อน +1

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

  • @Kirti-bi2yj
    @Kirti-bi2yj 5 หลายเดือนก่อน +3

    I literally started dancing on the tune at the end.😂

  • @arpitgarg6459
    @arpitgarg6459 2 ปีที่แล้ว +2

    You are a JS god !!! Hands down...Thank you so so much @Akshay Saini... Just can't believe this all is free. Super interesting videos.. watching at 1.5x speed and able to grasp everything, till this episode.

    • @arpitgarg6459
      @arpitgarg6459 2 ปีที่แล้ว

      Completed the whole series.. correction. binge watched the whole series and I feel so confident now. Before, I was doing work without knowing the proper logic. Now, I have so much clarity. Also, your video on prototype inheritance and interview experience are a great help. Aiming for a good jump now and you'll be the first one I would thank if my job switch is successful

  • @kuntalbhattacharyya7614
    @kuntalbhattacharyya7614 3 ปีที่แล้ว +4

    "temporal dead zone" is the time since when the let variable is hoisted and till it is initialized to some value, the time between that is known as the temporal dead zone.

  • @rashmi5635
    @rashmi5635 3 ปีที่แล้ว

    Earlier in the past everytime I will read the documents to understand the concept of let,var and const but after seeing this video and writing down the notes shrinked the repeated effort.Amazing content.

  • @afaquezia
    @afaquezia 4 ปีที่แล้ว +4

    yes sir! I understood the temporal dead zone very clearly. thank you a lot sir and Very happy diwali.

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +1

      Happy Diwali Afaque. 😇

    • @afaquezia
      @afaquezia 4 ปีที่แล้ว +1

      @@akshaymarch7 thank you so much sir..Nobody teaches with such depth

  • @Lalit_Shirsath
    @Lalit_Shirsath 3 ปีที่แล้ว

    I havent seen any teacher with such a enthusiasm ever. Hats off to you sir. You made our javascript journey so much easy

  • @0xFOXHOUND
    @0xFOXHOUND 4 ปีที่แล้ว +15

    For revision:
    always keep your variable declaration on top! on top!
    is 'let' and 'const' functions are hoisted? > Yes (but in temporal dead-zone)
    take a sample program
    console.log(b);
    let a= 10;
    var b= 100;
    we made var declaration to 'b' and let to 'a' and here comes the difference: the var declaration will come under global declaration and let declaration in script (separate memory space) and these variables are not accessible unless they are assigned with certain values
    so the temporal dead zone is the time between saving variables in memory-space and actually value assigned to it by engine itself. In this time frame you can't access the variable, by hoisting, Engine stores the Variable in 'Variable environment'(Memory component) and until the line where the actual variable is assigned to its value (until then variable, remains in temporal dead zone)
    ReferenceError cannot access before initialization : avoided the concept of temporal Dead zone, bound you will get this error!
    Q)How it differs from "Uncaught ReferanceError : X is not defined at .js" ?
    A> so it comes to a question "is variable X is in Variable environment ?"
    >> if(true);
    {
    console.log("cannot access before initialization");
    console.log("This is temporal dead zone case");
    }

    if(false);
    {
    console.log("Uncaught ReferanceError : X is not defined at.js");
    console.log("Variable is simply not available");
    };
    Q) and what about variable declared by 'var'?
    > they will assigned 'undefined' until a value is assigned
    Declaration Type
    var = saved in Global execution context, can be assigned later and modified in script.
    let = saved in script execution context, temporal deadzone affects it and can later modified in script.
    const= saved in script execution context, temporal deadzone affects it and must be defined (assign values) when defining variable by it (cannot remained as 'undefined').

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว +10

      Write a blog brother, this effort of yours might get lost in so many comments.
      BTW love your dedication, you're a gem! 💥

    • @aliadel1723
      @aliadel1723 2 ปีที่แล้ว

      thank you ♥

  • @Shirishamutyala
    @Shirishamutyala 11 หลายเดือนก่อน

    I have been watching your videos from the beginning and taking notes.Completely addicted to these videos to that level even though I’m doing other works the concepts are running at the back of my head.Thanks brother

  • @ashishkumarsharma404
    @ashishkumarsharma404 4 ปีที่แล้ว +3

    When you said let and const have block scope , block scope, block sock, it sounded like mujhe drugs do, drugs do , drugs do :P

  • @harshdobariya3327
    @harshdobariya3327 ปีที่แล้ว +1

    content - amazing
    energy - hats off
    music at the end - vibe he

  • @yourfriendnur
    @yourfriendnur 2 ปีที่แล้ว +1

    Before watching these videos I could write basic javascript code but I didn't know these important things. Now I think theses are the most important things which should be known to us. So Thank you very much sir❤❤.

  • @siddharthbehra5250
    @siddharthbehra5250 6 หลายเดือนก่อน

    Maja aa gya Sahab, bohot sahi, itna khush hoke padha rhe h, shows true passion for teaching and making everyone understand. Love it :)

  • @anshikgupta2993
    @anshikgupta2993 3 ปีที่แล้ว +1

    This is the best JavaScript course, I really wonder how did you learnt so much deep.

  • @mercypill124
    @mercypill124 ปีที่แล้ว

    just love this video.......................firstly i was very confused with scope of let and var but after seeing this video all my doubts are cleared

  • @siddhapan
    @siddhapan 3 ปีที่แล้ว

    Saying the words Temporal Dead Zone alone is giving me chills!

  • @AbhishekKumar-cp7tr
    @AbhishekKumar-cp7tr 2 ปีที่แล้ว

    Best explanation ever I got. No confusion anymore about how this let, var, and const work.

  • @Jothikajo2001
    @Jothikajo2001 11 หลายเดือนก่อน +1

    00:02 Understanding the differences between let and const in JavaScript
    02:24 Understanding the differences between let and const in JavaScript
    05:05 let & const in JS - Temporal Dead Zone
    07:43 Understanding the temporal dead zone and accessing variables in JavaScript.
    10:27 Understanding the let and const keywords in JavaScript
    13:43 Understanding let and const in JavaScript
    16:33 let & const are used to declare variables in JavaScript.
    18:52 Understand the usage of let and const in JavaScript

  • @bittuyadav7707
    @bittuyadav7707 7 หลายเดือนก่อน

    Best javascript series ever.
    I used it to revise my concepts.
    Thanks Akshay sir.

  • @mayanksahu6486
    @mayanksahu6486 3 ปีที่แล้ว +1

    never seen such kind of explanation ever before in any tutorial. You are truly a gem. Thanks for making this amazing series. May God bless you

  • @sahilambekar6854
    @sahilambekar6854 3 ปีที่แล้ว

    every time i think that its just a basic video and i know all about this topic, but after watching your video on same topic i found that there are tons of things to learn which were abstracted in our day to day work

  • @thekingraghuraman
    @thekingraghuraman 3 ปีที่แล้ว

    A small fact I would like to point out is instead of saying let should be initialized, we need to say declared. What I mean is
    console.log(a) // Would throw ReferenceError here
    let a;
    console.log(a); // will print undefined , same as var
    a = 'Hi';
    console.log(a); // will print Hi
    Great Video

  • @vinodgodti9301
    @vinodgodti9301 4 ปีที่แล้ว +1

    I love your depth knowledge of java script. "use const first and then let for variable declarations in day to day coding" this should be followed by every js developer.Hats off for your efforts to make this kind videos.👌👌👌👌

    • @akshaymarch7
      @akshaymarch7  4 ปีที่แล้ว

      Thank you so much for your comment, Vinod. It motivates me. 😇♥️

  • @isaacprosper6295
    @isaacprosper6295 2 ปีที่แล้ว

    this dude is legit and very passionate i wish i discovered this channel earlier

  • @ankursanadhya4584
    @ankursanadhya4584 2 ปีที่แล้ว

    one of the best js course on the planet ....good job sir!!!

  • @theyashgaur3236
    @theyashgaur3236 2 ปีที่แล้ว

    no one teachers these concepts clearly..
    thanks for these videos bhaiya..

  • @sameer1571
    @sameer1571 3 ปีที่แล้ว

    Aap samjhao aur hume samjh na aaye aisa ho sakta hai love u sir for the knowledge you are sharing

  • @frank3481
    @frank3481 4 ปีที่แล้ว

    This is literally the best explanation of Hoisting & errors for var, let and const in the world.
    Why is it sometimes 'is not defined ' and ' Reference Error cannot access before initialization '?
    The error message shows differently with the same code.
    Are they the same thing?
    ex)
    console.log(a); // is not defined or cannot access before initialization
    let a = 10;

  • @khalidben9940
    @khalidben9940 2 ปีที่แล้ว +2

    This man is really a fantastic teacher.I congratulate you for this level of understanding and explaining.

  • @shubhamsomani760
    @shubhamsomani760 3 ปีที่แล้ว +1

    I love the way you are teaching...lots of love from my side...

  • @palakjain7612
    @palakjain7612 ปีที่แล้ว

    Sir your way of explaining the very difficult topic to the very least difficult way is beyond imagination i have also seen your namaste react and really got to learn a lot thank you so much...........

  • @sarthakdua4589
    @sarthakdua4589 3 ปีที่แล้ว

    Never really knew earlier why do we get those reference errors. This video has given me the answer after 3 years of using them. Keep up the good work and keep sharing your tutorials brother!

  • @Kajatelex
    @Kajatelex ปีที่แล้ว

    lots of love u mere bhai... i am not taking any paid course. i am learning a lot of thing from ur videos..

  • @rajnishkumarmaurya3340
    @rajnishkumarmaurya3340 28 วันที่ผ่านมา

    00:05 - Understanding let and const in JavaScript and the Temporal Dead Zone concept.
    01:11 - Understanding variable access and differences in JavaScript's let and const.
    03:16 - Understanding memory allocation for let and const in JavaScript.
    04:34 - Understanding JavaScript execution and memory management through code execution.
    06:54 - Understanding Temporal Dead Zone in JavaScript's let and const.
    07:57 - Understanding variable access and the Temporal Dead Zone in JavaScript.
    10:16 - Understanding scoping and declaration in JavaScript.
    12:06 - Explains variable declaration differences in JS using let and const.
    14:36 - Understanding variable declaration and Temporal Dead Zone in JavaScript.
    15:53 - Discusses variable declarations and scoping in JavaScript.
    18:28 - Understanding unexpected errors in JavaScript's temporal dead zone.
    19:27 - Understanding 'let' and 'const' in JavaScript to avoid the Temporal Dead Zone.

  • @AmanSharma-hj5yy
    @AmanSharma-hj5yy 8 หลายเดือนก่อน +1

    you are the Gem for guys who preparing for interview :)

  • @prakalpvarshney8659
    @prakalpvarshney8659 4 ปีที่แล้ว

    I was already in love with JS... but i was unaware of these concepts...Ek tarfa pyaar ko do tarfa kardia aapne...A Huge Thanks!!!

  • @raunaque5973
    @raunaque5973 3 ปีที่แล้ว +1

    Never saw this deep enough on let, const, and var. Thanks for the content. Love you bro

  • @Rajveer__singhhhh
    @Rajveer__singhhhh 11 หลายเดือนก่อน +1

    Yahoo baba, code with Harry , hitesh choudhary, Akshay saini javascript master teacher❤

  • @shekhargupta5307
    @shekhargupta5307 3 ปีที่แล้ว

    I like your way pf teaching, pehli bar basic itne acche se clear ho rahe h, nice bro

  • @drapala97
    @drapala97 3 ปีที่แล้ว

    I am very grateful for your videos, Akshay Saini!
    *below is a personal note to myself
    1) compilador aloca espaço na memória para as declarations (var, let, const, function declaration, e class declaration), isso se chama hoisting.
    2) enquanto var é indexada no objeto global, let e const ficam na temporal dead zone
    3) por estar no objeto global, o acesso à var é permitido, entretando seu valor é undefined até ocorrer o assignment
    4) enquanto não ocorrer o assingment à let e const, elas continuam na temporal dead zone, e enquanto estão neste local, o acesso à estas declarations é impedido (unitialized)

  • @InspireDaily0007
    @InspireDaily0007 3 ปีที่แล้ว

    Thak you sir. The way of your explanation is great. Nobody will be regret it. Really you are so amazing.

  • @manjeshsingh3002
    @manjeshsingh3002 11 หลายเดือนก่อน

    seen playlist of other tutors but Akshay gives the best clarity. Thanks man

  • @suny424
    @suny424 3 ปีที่แล้ว

    Best part of this videos is the explanation in very easy language.