Can't believe instead of Netflix I am watching javascript videos in free time...
@vitalvisions4U
3 жыл бұрын
Same. Had plans for RAY on this weekend. Ending up watching 5 videos of this series.
@mizanur_sajid
3 жыл бұрын
surely with no credit card 😬
@stevenedwards9262
3 жыл бұрын
Much more valuable use of your time, id say
@hellonishant
3 жыл бұрын
same here
@valp_co
3 жыл бұрын
This playlist is pure gold
@parthajagiya4439
3 жыл бұрын
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
3 жыл бұрын
thanks
@surajpatil3247
3 жыл бұрын
@Akshay Saini pin this comment
@deependrakumar2019
3 жыл бұрын
Just one correction let variable can be reinitialize.
@karljosebuena
3 жыл бұрын
@@deependrakumar2019 thanks for the notes :)
@nikhil4844
3 жыл бұрын
Thank you
@akshaymarch7
3 жыл бұрын
Next Video: let & const Block Scope and Shadowing in JS 🔥 - kzitem.info/news/bejne/zY2Vy6aJo6t-mII How was this video? Are you feeling excited? Let me know in the comments below. ❤️
@samarth319
3 жыл бұрын
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
3 жыл бұрын
plz Bhaiya jaldi jaldi videos upload kijiye ... i m so excited to learn JS properly.
@ayushjain7658
3 жыл бұрын
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
@KrishanKashyap108
3 жыл бұрын
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
3 жыл бұрын
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
@jagrutsharma9150
2 жыл бұрын
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
2 жыл бұрын
Very Good Explaination
@rajendrasinghbisht5119
2 жыл бұрын
Awesome Summary just like the video
@robertobenedit
2 жыл бұрын
Bravo!
@gulz4u
Жыл бұрын
@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
Жыл бұрын
@@gulz4u let variable value can change without using let word again eg: let a=10; a=20;
@Kirti-bi2yj
2 ай бұрын
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.
@corporatetrainers3286
3 жыл бұрын
This is the best charity anyone can give. Thank you for not charging for these videos.
@renatoalves92
3 жыл бұрын
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
10 ай бұрын
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??
@poornimank3672
Жыл бұрын
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
5 ай бұрын
if you donot mind mentioning those 10 faileinterview company names, we will apply now??
@LifepartChandigarh
6 ай бұрын
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 💎
@VikashKumar-ox2hv
3 жыл бұрын
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.
@sounaksaha1455
Жыл бұрын
PUN at its best
@ravikanthkaligithi1820
8 ай бұрын
😀
@nareshbhati7527
3 жыл бұрын
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.
@brahmanandas1909
3 жыл бұрын
Basically am a java developer I never really liked js, but u just made me start loving it... ಧನ್ಯವಾದಗಳು❤️
@B-Billy
3 жыл бұрын
Same here... so much frustration.
@universal4334
3 жыл бұрын
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
3 жыл бұрын
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
3 жыл бұрын
@@akshaymarch7 thank you for your efforts, still I will be checking your channel is there any new video ❤️❤️❤️
@nike0822
3 жыл бұрын
@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
3 жыл бұрын
Hello @@akshaymarch7, can you please make a video series on backend(.net c#, mvc controller) web development as well . Your explanation is amazing.
@SameeraPkChannel
3 жыл бұрын
I guess if u take any JS interview then nobody in this world would get hired .Absolutely amazing tutorials bro .Keep going 😊😊😊
@akshaymarch7
3 жыл бұрын
Haha, nothing like that brother.. 😅
@robingupta7895
3 жыл бұрын
No, Not like that I think he will hire the best person...
@gajananlimbale670
3 жыл бұрын
😂😂
@mahimak5736
3 жыл бұрын
We can clear his interview after watching all his videos 🤣
@rishitiwari6200
3 жыл бұрын
@@mahimak5736 he be like:Mera maal mere ko hi bech rha
@Kirti-bi2yj
2 ай бұрын
I literally started dancing on the tune at the end.😂
@atsglobalservices6136
2 ай бұрын
watch this video last year (unemployed), now im employed
@jayjani740
3 жыл бұрын
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.
@shivamaggarwal9157
3 жыл бұрын
Thanks, @Akshay for making things clear soo beautifully. However, I've got two doubts 1. console.log(a); let a = 10; // Gives a reference error because a was in TDZ as it wasn't initialized, whereas if we do let a; console.log(a); // This gives undefined. But a is till not initialized yet, it's only declared. And when I look back on TDZ, It creates confusion. 2. We studied in past videos that in global scope in browser env, `this.a`, `window.a` & `a` are all same. However, I do not declare a, and then try to access it using all 3 ways, `this.a` and `window.a` gives me `undefined`, but `a` gives a reference error. While all the three are trying to find `a` in the same scope.
@SemicolonGuy
3 жыл бұрын
Watching whole series the second time just before my interview ❤️
@mrankushtechnical
3 жыл бұрын
Can anyone explain why window.x; is giving undefined when X is not defined.
@shimanshuyadav5654
2 жыл бұрын
All the varaible are the property of global object windows so when you try to access property of object which is not there then it shows error.
@talibbb13
7 ай бұрын
Most probably... Window an object and they behave differently than the way we access to variable on global scope... And in object if anything isn't present there it simply gives undefined idk y so but it happens 👍
@dhawaltiwari6193
3 жыл бұрын
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??
@tech_stranger_
2 ай бұрын
-> 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
@adabus8779
2 жыл бұрын
@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
2 жыл бұрын
Good catch. Not that this is for let only. For const, since we hv to initialize them during declaration this wont be possible.
@ycombinator765
2 жыл бұрын
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
Жыл бұрын
@@ycombinator765 exactly, it's like declaring a new variable
@shreedevijamakhandi1877
3 жыл бұрын
Without watching video first I like the video Always love ur video with good information
@akshaymarch7
3 жыл бұрын
Thank you so much, @Shreedevi. It means a lot. ❤️
@aayush5474
3 жыл бұрын
i am addicted to this series! Can't wait for next one! Making notes with every episode :)
@akshaymarch7
3 жыл бұрын
Oh, wow! That's great, it's a very good way to remember things. 😇
@sriramray4694
Ай бұрын
kya aap notes send kar sakte hai
@karthiksripad526
3 жыл бұрын
Thanks, Akshay. I have few questions. First Question: let a; console.log(a); Here, "a" is still in a temporal dead zone right? How are we able to access this? Second Question: When we initialize variables with "let" inside a function, Browser Console does not show a separate memory space called "script" in the function's Execution Context. Why?
@VIDLIKER
3 жыл бұрын
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
3 жыл бұрын
I see a lot of people doing that. 😅 But don't worry, now you know what to answer. 😉
@bhushanambhore8378
4 ай бұрын
let & const are hoisted, they are also allocated with the memory but not like var (global memory) but with different memory. Accessing let and const before initialisation will give 'referenceError' as it will comes under 'Temporal Dead Zone' which is nothing but the time period between their hoisting and initialisation.
@roshansinha1438
Жыл бұрын
Hi @akshaymarch7, I am pretty much liking your course but I found a small bug in your explanation. As you told Temporal Dead Zone Exists until variable is declared and until it has assigned a value but that’s not true. Temporal Dead Zone exists until the point of declaration. Example : let a; console.log(a); Explanation : As you can see I haven’t assigned any value to a till now but still this code is fine and it'll run without error, because Temporal Dead Zone is finished after line 1 as we have declared variable 'a' in 1st line. Hope you can rectify your video. Because this will put wrong assumptions in many other developers 😃
@sougandikal6022
3 жыл бұрын
Temporal dead zone: Time gap between the variables hoisted and its initialization, Understood clearly about it Thank you Akshay Stay blessed :) :)
@vishalgoel6323
3 жыл бұрын
Shouldn't it be declaration instead of initialisation ?
@paisastocks8363
2 жыл бұрын
@@vishalgoel6323 It should be initialisation only.
@sheersendughosh
3 жыл бұрын
** DUMP QUESTION ALERT** If these let and const variables are not present in the Global object then where are these present? Like where are these in call stack? The first thing that is there in call stack is the Global EC. So this memory space where the let variables are assigned memory, where is this present? It might be a very dump question, but I want to learn. Love the way you explain @Akshay Saini Bhaiya. ❤. Kindly help.
@shovarajouria110
3 жыл бұрын
Just a request , after completing this course could you explain how css works in detail ! Amazing content as usual
@drafercuber9943
3 жыл бұрын
Can I
@akshaymarch7
3 жыл бұрын
Added to my list, will try to cover that also. 😇
@soulseller1838
2 жыл бұрын
@@akshaymarch7 Is it still on list?
@madeinscript4623
3 ай бұрын
@@akshaymarch7sir hope ur list will be made soon
@yogeshrawat1204
2 жыл бұрын
This is also throwing a reference error. Can anyone give reason? function anotherRandomFunc(){ message = "Hello"; let message; console.log(message); // Throws a ref error } anotherRandomFunc();
@VipulDessaiBadGAMERbaD
2 жыл бұрын
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
@Prajjwal191
Ай бұрын
it was a great tutorial bhaiya❤. I have one question when you use breakpoint at first line itself all var a, let b and const c have undefined but in my case it is var a has undefined and b and c has is it due to some update javascript. ?
@rhimanshu6288
3 жыл бұрын
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
3 жыл бұрын
Not everything which is Free is useless ❤️
@namanmehta
2 жыл бұрын
As said in video, a 'let' variable is in temporal dead zone until it is 'initialized', and it not accessible. But On trying this : let a; console.log(a); a=10; 'undefined' is logged. till line number 2, a wasn't initialized na? 'a' is only declared and not initialized till line number2. Why aren't we getting Reference error : "cannot access a before initialization" here?
@dademix
3 жыл бұрын
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.
@EMonzon
Жыл бұрын
wait! around minute 10:40, you showed that there's a memory allocation for let variables on the global scope...😯, if not, it won't display undefined when you do: this.x🤯 Am I seeing it wrong?
@dibyendubiswas1998
3 жыл бұрын
#LovingIt. When I read this concept in book, then I am bored but today I am not bored.
@ranuchakravarti3277
11 ай бұрын
Please state definition also in every video so that we can tell in interviews
@naveenkumarpulikonda1998
3 жыл бұрын
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
3 жыл бұрын
Wow, Congratulations brother! ❤️
@rahulkumarpal3279
8 ай бұрын
Hoisting in js? hoisting in javascript allows to use the variable and function before they are declared in the code we know that every line of code are assigned with some memory. So when we declared the var variable its also assigned some memory in global scope attached with the global object. So we can excess the variable throughout the program And during execution phase it initializes with undefined But when we declared the variable with let and const it is also hoisted in js. But they assigned with some block scoped not global scope which leads its not initialize during hoisting phase which leads to temporal dead zone temporal dead zone means it is period between block scopes and declaration in which if we access the variable return references error I write it down what i understood 😁😄
@varnikaraghav3781
3 жыл бұрын
Make more videos on js concept for interview perspectives. The way you explain everything was great!
@akshaymarch7
3 жыл бұрын
Thank you so much, Varnika. Your comment motivates me to make more videos. ❤️
@techamusement6714
2 жыл бұрын
10:32 Why is it throwing undefined even if it hasn't been declared and allocated memory i.e. run through memory allocation phase?kindly answer this I have already got this ans:- it happens due to prototype chain
@shaileshkamble8730
Жыл бұрын
I have been studying these concepts last one year but now I understood all Advance JS concepts through visualization . Thanks . your efforts are appreciable .
@DeepakGupta-zz1vf
3 жыл бұрын
can we say Temporal time zone is Time gap between the variables hoisted and its declaration let a; console.log(a); here output is undefined this means temporal deadzone ends at declaration right????
@sarav-Frontend_Engineer
2 жыл бұрын
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 😃
@aayushbhardwaj212
2 жыл бұрын
Hello akshay, some of your videos are unavailable like event loop and javascript engine. Please look into it brother as I need them really badly right now.
@chinmaydas4053
3 жыл бұрын
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 🙏🙏..
@Amandeepsinghjaura10
3 жыл бұрын
Why js engine not able to find let variables when they undefined (TDZ) and how they get it once they initailized, since both of times they are different memory scope and not in global object. Is there any scope chain from global to script object? If yes why it does not find when they are undefined?
@kuntalbhattacharyya7614
3 жыл бұрын
"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.
@yfjsdgzjdnfn
6 ай бұрын
Is there any course just like namaste javascript for Java language
@avikkarmakar6333
2 жыл бұрын
I genuinely appreciate your efforts of making the concepts clear to us.. thank you so much for the series, I'm learning a lot
@bhushanambhore8378
4 ай бұрын
Understood the 'Temporal Dead Zone' as soft & smooth as butter ;)
@0xFOXHOUND
3 жыл бұрын
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
3 жыл бұрын
Write a blog brother, this effort of yours might get lost in so many comments. BTW love your dedication, you're a gem! 💥
@aliadel1723
2 жыл бұрын
thank you ♥
@pritamkar2019
2 жыл бұрын
At 10:30 , why does 'window.x' shows 'undefined' instead of a ReferenceError ?
@ashishkumarsharma404
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
@akshaymarch7
3 жыл бұрын
😅
@geetamsinghkushwaha8323
3 жыл бұрын
console.log(a); let a; a = 10; //Explain it sir please it will not give any error.
@deepjyotkaurbindra
3 жыл бұрын
I have never come across such high-quality content on JS. Thanks for digging so deep.
@thotakurasainarasimharao3843
7 ай бұрын
Hi aksay, pls explain below question. let x= 100: x=10; console.log(x) gives us 10 let x=100 let x=10 console.log(x) gives sytanx error can anyone explain what is difference between these two and in case of const 1st code is thrwoing type error and second code is throwing syntax error
@LifepartChandigarh
6 ай бұрын
Because in 1st if we use const so we can't redeclare or reassign value to it. In case of let we can't redeclare it but can assign it value. In your case 1st - I think you are doing something like. const a = 10 a = 100 which is wrong here you are assigning value to const let x= 12: let x = 18; It's also wrong because here we re--declared let variable.
@SnehJoshi19
3 жыл бұрын
Waited for long😍
@SuperVaibhavcool
4 ай бұрын
The Myth, The Legened, The Miraculous: Akshay Saini!
@afaquezia
3 жыл бұрын
yes sir! I understood the temporal dead zone very clearly. thank you a lot sir and Very happy diwali.
@akshaymarch7
3 жыл бұрын
Happy Diwali Afaque. 😇
@afaquezia
3 жыл бұрын
@@akshaymarch7 thank you so much sir..Nobody teaches with such depth
@nurulhasan2479
3 жыл бұрын
Hello @akshay You said that we can't declare the same name in the same scope again. So how is this possible? 1.for (let a = 1; a
@kashifahmed_1995
3 жыл бұрын
Nice question.How did you get this in mind?
@1990darsh
5 ай бұрын
Hi @akshaymarch7, One correction is there for the temporal dead zone, it is not mandatory to assign a value if use let for declaring a variable. . So temporal dead zone exists until variable is declared that's it. Without assign value we can access it. Even I learn this from your video only so thanks to you .
@bhushanambhore8378
4 ай бұрын
1. console.log(a1); 2. let a1; here a1 in line 1 is in TDZ, as u said Without assign value we can access it. but we cant access it as it is giving ReferenceError
@phpprojects
3 ай бұрын
1. Temporal dead zone is a time duration between the declaration and the initialization of let/const. 2. The 'let' and 'const' both are hoisted but behave different than 'var'. 3. The 'let' and 'const' both are created in a separate memory location than global. 4. We can define 'let' without initialization but cannot access it unless it is initialized. 5. We cannot even define 'const' without initialization.
@goutambhattacharyya6908
7 ай бұрын
Hi Akshay, I'm getting instead of a: undefined. Can you please clear this.
@ankitasood8589
6 ай бұрын
Yes, i think it has changed over time
@sabihaambari8652
3 жыл бұрын
The TDZ ends when aLet is declared, rather than assigned: //console.log(aLet) // would throw ReferenceError let aLet; console.log(aLet); // undefined aLet = 10; console.log(aLet); // 10
@neerajatokekar1079
2 жыл бұрын
But in that case the ReferenceError thrown in the first line should be ' x is not defined' but it throws 'cannot access 'x' before initialisation'.
@arjunshetty6222
2 жыл бұрын
@@neerajatokekar1079 the error "Cannot access variable before initialization" isn't referring to variable assignment(ie let a=2 or a=2) but the compiler variable initialization step which for "let" variables occurs when a "let" variable declaration is reached in code(ie let a or let a=2).Don't be confused by the error message.
@arjunshetty6222
2 жыл бұрын
@@neerajatokekar1079 and the reason the error is not "variable not defined " is because during Execution Context creation phase(which comes before EC execution phase),the runtime processes "variable declarations" in scope(this is a internal step not realt3d to var a or let a line in code). For "var" variables declaration and initialization happens in EC creation phase but for "let" only declaration happens.Hence variable is defined but not intialised till actual declaration(let a or let a=2) is reached in code during EC execution phase.
@dipenchavda6988
2 жыл бұрын
Somehow I can't see his videos on closures right now and it is saying that those videos are hidden.
@neenakhan4326
3 жыл бұрын
I am just a fan of your videos.. :) thanks @Akshay
@sreerajnair2235
3 жыл бұрын
Simply Amazing! One doubt please, why does window.x or window.fdfd or window.something gives undefined instead of not defined. (Note that memory is not allocated for these variables anywhere)
@akshaymarch7
3 жыл бұрын
We will cover that when talking more about Objects in detail. For now just remember, it has nothing tk do with window object. 😇 Everything will be covered, keep watching. ❤️
@SableRaf
2 жыл бұрын
@@akshaymarch7 I had the same question, came to the comments for an answer, and bam. You never miss! 😃
@asishraz6173
3 жыл бұрын
Wowwww. LET, CONST, TEMPORAL DEAD ZONE REFERENCE ERROR GLOBAL OBJECT TYPE ERROR SYNTAX ERROR Now I am ready for interview.
@theleftycoder
Жыл бұрын
It is hard to find this kind of energy for javascript
@anilsdoshi85
3 жыл бұрын
in console, this.x gave undefined value ( when x was nowhere declared in code) and in code (in index.js file) when x was accessed it gave reference error that's it is not defined. Ideally, even in console, it should throw a "not defined error right"? why in the console when an undeclared variable is accessed via global object ( i.e. window.x or this.x ) not throwing the error
@akshaymarch7
3 жыл бұрын
I'll cover that while explaining Objects. It has nothing to do with 'this' or 'window'. It's the behavior of any object. I'll cover that in upcoming videos.
@AmanSharma-hj5yy
5 ай бұрын
you are the Gem for guys who preparing for interview :)
@vinothkumarv9722
3 жыл бұрын
Vinoth love >> Akshay: Hi akshay I go one doubts from tempora dead zone getting confused I came again then clear now.. ❤️❤️❤️❤️
@shayakdas2688
3 жыл бұрын
Consider the js file only having 1 line "var a = 10;" After execution, the call stack vanishes. But if I write 'a' in console, it prints '10'. How does this work?
@Siddhinandaniya2811
2 жыл бұрын
Every time you try to get value of 'a' or enter 'a' in console. The code again runs in Execution context that's how it gets the value of 'a' . Thank you. I hope it helps.
@TheMalni
3 жыл бұрын
Funny thing, when you are asking "OK?", I'm nodding my head as if we were in the same room 😁
@MeTheKnowledgeSeeker
5 күн бұрын
Now browser is showing instead of undefined for variables in TDZ? In 2024 Am I correct
@drafercuber9943
3 жыл бұрын
I am learning for my MERN stack
@nikhil6842
3 жыл бұрын
Hi Akshay, great video, I need one clarification. at 13:48, if we log a at line 3, it doesn't throw error. consider below snippet:- console.log(a); line 1 //a:undefinded (in temporal dead zone); throws err; let a; line 2 // a: undefined console.log(a); line 3 // prints undefined; no err; a = 100; line 4 console.log(a); The value of a before and after execution of line 2 is undefined, so why doesn't line 3 throw err before initialization in line 4, since a should be in temporal dead zone?
@akshaymarch7
3 жыл бұрын
Awesome doubt, thank you for asking. So the Temporal Dead Zone ends after the declaration statement. console.log(a); line 1 // Error because of Temporal Dead Zone let a; line 2 // TEMPORAL DEAD ZONE ENDS HERE console.log(a); line 3 // value of `a` CAN be accessed now, but `undefined` a = 100; line 4 // value of `a` modified to 100 console.log(a); Hope it's clear now. Thank you for your question, it will help everyone. 😇
@nikhil6842
3 жыл бұрын
@@akshaymarch7 thank you Akshay, for clarifying it.
@sameerkale8307
2 жыл бұрын
Thx man, ty so much. Its a free & powerful content, will recommend to my friends too.
@anjalimaurya7598
3 жыл бұрын
every songs in the end of video hear like word namaste javascipt lyrics with superb music tone .
@TheDhanush
24 күн бұрын
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.
@savitaverma1716
2 жыл бұрын
@Akshay Please Please make Namaste React series too 🥺
@ApurvKhare
3 жыл бұрын
Why does window.x return undefined, shouldn't it be not defined because it is not even declared anywhere ?
@awekeningbro1207
3 жыл бұрын
Think of window as an object. When you try to access a key which is not present in a given object, it will give you 'undefined'. Same thing is going on here.
@priyanshubhardwaj2158
3 жыл бұрын
Bhai kya banda h yar. As promised you're going to make us fall in love with JS by the end of this playlist!
@haha44261
Ай бұрын
Javascript: Hoisting in let and const: A separate memory space is provided to let and const, it is not present in window object. //code console.log(a); let a = 10; //output ReferenceError: Cannot access 'a' before initialisation (This is different from undefined and not defined) Temporal Dead Zone: The time between the let and const variables are hoisted and they are initialised. We can’t access the variables which are in temporal dead zone. ** It is not possible to redeclare a ‘let or const’ variable. let a = 100; let/var a = 123; console.log(a); SyntaxError: Identifier 'a' has already been declared ------------- **const variables should be initialised at the time of declaration let a; const b; a = 34; b = 3345; SyntaxError: Missing initializer in const declaration Reference Error : if we try to access variables which are not present in the memory or the variables are in temporal dead zone. Syntax Error : if we write something which is not expected by the compiler. type error ... while trying to re-initialize const variable ***To avoid temporal dead zone, put all initialisations and declarations at the top. It shrinks the temporal dead zone to zero.
@buzzfeedRED
8 ай бұрын
Hey Akshay! just a quick recap of it with function scoped varible. in function scoped varibale also follow the shadowing logic as function scoped variables are also the block scoped.. var x = 1; a(); b(); console.log(x); function a() { var x = 10; // local scope because of separate execution context console.log(x); } PLs explain
@gamerakkipad5098
3 ай бұрын
15:12 || 17:51 (Summing up) Different types of variable's Errors in JS with their possibilities: - Type Error: [Since the variable is const type, it is supposed to be initialized right after it is declared in the same line. Not later] ~ While reinitializing the const variable. - Syntax Error: [Not in proper JS syntax or defined grammar of JS, you are missing something or using in a wrong way] ~ While just declaring const variable and not initializing it. ~ While redeclaring let variables. - Reference Error [When JS engine tries to find out a variable inside a memoryspace and you can't access it.] ~ When consoling the let, const before it's being declared i.e It is in its TDZ (Temporal Dead Zone). ~ Also when you try to find a unknown variable which is not even created. Note: var can be accessed even before declared because it is placed in Global Execution Context and always gives undefined. How to use these variables while coding your application? var
@tusharverma4470
2 жыл бұрын
when we re-intialize the let variable in another function in same code it does'nt give any error can you explain. ------------------code---------------- let a=10; console.log(a); function f(){ let a=20; console.log(a); } f(); ------------console----------- 10 20 But you said we can't re-intialize let variable.can you explain?
@sourabhhulloli2175
2 жыл бұрын
we unable to watch or access Ep.14
@abhilashcr9247
3 жыл бұрын
console.log(a) //error let a; console.log(a) //undefined, we have not initialized variable, error should come right?
@suprimestar7722
3 жыл бұрын
Good question
@suprimestar7722
3 жыл бұрын
If js by default set to undefined during memory allocation phase then what about this x=10; console.log(x); let x; If let is hosted and it acts as well as var and initialise with undefined
@namaste-shorts-2004
Ай бұрын
I think I was in "TEMPORAL DEAD ZONE" Until I complete this video :)
@spmaurya10
5 ай бұрын
Not sure why but for me value of a is showing instead undefined let a =10; console.log(a); var b=100; I added a breakpoint before let a =10 then under Source ? Script a:
@sakshirathi3077
6 ай бұрын
let & const are hoisted in Temporal Dead Zone for time 't'. *let & const* are hoisted in Temporal Dead Zone for time 't'. They are hoisted in different way - Memory isn't allocated to *let* in Global Space but it is allocated the undefined to let variable. Temporal Dead Zone is a time from when the let variable is hoisted to the time it has been initialised. And we can't access the let variable from temporal dead zone - it will result in reference error. We can access it anywhere after its initialisation. Good practice to declare variables - const>let>var Types of error - Reference & Type error are similar to Run time error Syntax error is similar to Compile time error. Variable declaration var -> Associated with Global object (can be accessed window/this object), can be re-declared & re-initialized let -> Associated with TDZ, can't be re-declared & can be re-initialized const -> Associated with TDZ, can't be re-declared & re-initialized Example: console.log(a); console.log(b); console.log(c); var a = 25; let b = 56; const c = 45; ❌let b = 12; ❌const c = 34; ✔️var a = 26; ✔️b = 100; Output: Undefined Reference Error Reference Error
@Sharmaa07_
3 ай бұрын
Key Concepts about let, const Hoisting of let and const: Both let and const declarations are hoisted to the top of their containing block, but unlike var, their memory is allocated in a different place, making them inaccessible before initialization. This is known as the Temporal Dead Zone (TDZ). Temporal Dead Zone (TDZ): The TDZ is the time between the hoisting of the variable and its initialization. Accessing the variable in this period will result in a ReferenceError. Window Object and Scope: Variables declared with let or const are not added to the window object. Thus, window.variable or this.variable will not return the value of a variable defined using let or const. Variable Redeclaration: You cannot redeclare the same variable within the same scope when using let or const. Attempting to do so, even with var after using let or const, will result in a syntax error. const Declaration and Initialization: A const variable must be declared and initialized on the same line. Attempting to declare it without initialization or reassigning it will result in a TypeError. Types of Errors: ReferenceError: Occurs when trying to access a variable that is not yet declared or is in the TDZ. TypeError: Occurs when an operation is performed on a value of the wrong type or attempting to reassign a constant variable. SyntaxError: Occurs when the code is syntactically incorrect, violating JavaScript's syntax rules. Best Practices: Use const Whenever Possible: It signals that the variable will not be reassigned, reducing the likelihood of errors. Use let When Reassignment is Needed: Prefer let over var to maintain block scope. Minimize Use of var: Using var can lead to bugs due to its function scope and hoisting behavior. Initialize Variables at the Top: Declaring and initializing variables at the top of their scope helps minimize the TDZ and makes the code more predictable and readable.
@jagadeeshp1163
9 ай бұрын
Hoisting of Let N Const Temporal Dead Zone Reference Error Syntax Error and TypeError CONST >>LET>>VAR usage recommended ✅
@GildwareTechnologies
Жыл бұрын
In JavaScript, let and const are two modern ways of declaring variables. They were introduced in ECMAScript 6 (ES6) to replace the traditional var keyword for better scoping and to avoid certain issues that var had. One of the concepts associated with let and const is the "Temporal Dead Zone" (TDZ). let and const Declarations: let: Variables declared with let are mutable, meaning their values can be changed after initialization. They have block-level scope, meaning they are only accessible within the block (enclosed by curly braces) where they are defined. javascript Copy code let x = 10; x = 20; // Valid, changing the value of x const: Variables declared with const are also block-scoped, but they are read-only, and their values cannot be reassigned after initialization. However, the properties of objects declared with const can still be modified. javascript Copy code const y = 30; y = 40; // Error, reassigning a constant variable is not allowed Temporal Dead Zone (TDZ): The Temporal Dead Zone is a behavior that occurs when using let and const before they are formally declared in the code. During this phase, accessing the variable will result in a reference error. javascript Copy code console.log(a); // ReferenceError: Cannot access 'a' before initialization let a = 5; In the above example, the console.log(a) statement throws a reference error because the variable a is accessed before its declaration. This is known as the Temporal Dead Zone. The TDZ lasts from the start of the block (or function) where the variable is defined until the actual declaration is reached. Any attempt to access the variable during this period will result in an error. Conclusion: Using let and const for variable declarations in JavaScript provides better scoping and helps avoid certain issues associated with var. However, be mindful of the Temporal Dead Zone, especially when using let, as it can lead to unexpected reference errors if variables are accessed before they are formally declared. Understanding these concepts will enable you to write more reliable and maintainable JavaScript code. AIPRM - ChatGPT Prompts Favorites AIPRM Public Own Hidden Add List Topic All Activity All Sort by Top Votes Trending Model Not specific Search Prompts per Page 12 Showing 1 to 12 of 4020 Prompts Prev Next Human Written |100% Unique |SEO Optimized Article SEO / Writing · Jumma · 3 days ago GPT-3.5-turbo GPT-4 Human Written | Plagiarism Free | SEO Optimized Long-Form Article With Proper Outline [Upgraded Version] 5.9M 4.5M 1.7K Midjourney Prompt Generator Generative AI / Midjourney · kenny · 4 months ago Outputs four extremely detailed midjourney prompts for your keyword. 1.5M 979.8K 725 Fully SEO Optimized Article including FAQ's SEO / Writing · Muhammad Talha (MTS) · 1 day ago GPT-3.5-turbo GPT-4 GPT-4 browsing GPT-4 plugins [Version: 3.0 (Major Update)] This prompts create 100% Unique | Plagiarism Free | SEO Optimized Title, | Meta Description | Headings with Proper H1-H6 Tags | up to a 2000 Words Article with FAQ's, and Conclusion. 1.9M 1.4M 645 Yoast SEO Optimized Content Writer Copywriting / Writing · Luna Perkins · 1 month ago Write detail YoastSEO optimized article by just putting blog title. I need 5 more upvotes so that I can create more prompts. Hit upvote(Like) button. 120.0K 73.5K 562 Write a Complete Book in One Click Copywriting / Writing · Md Mejbahul Alam · 3 months ago Write a full book with different chapters 904.1K 557.7K 555 Write Best Article to rank on Google Copywriting / Writing · Faisal Arain · 5 days ago GPT-3.5-turbo GPT-4 Write Best Smart Article Best to rank no 1 on Google by just writing Title for required Post. If you like the results then please hit like button. 1.1M 740.0K 540 Buyer Persona Legend Marketing / Marketing · RonGPT · 5 months ago Generate detailed User Personas for your Business with data neatly organized into a table. 290.4K 141.0K 538 Human-like Rewriter - V1.6 Copywriting / Writing · pneb · 5 months ago Re-write your ai-generated article with this tool! You can get up-to 90-100% Human Generated score! 1.1M 751.8K 517 Get Monthly Content Calendar In 1 Click Marketing / Marketing · Google Business Profile Services · 2 months ago Get a beautifully organized 4-week content calendar that targets your primary keyword using only transaction longtail keyword & clickbait style post titles. Try it out! 532.4K 307.4K 508 KZitem Script Creator Copywriting / Script Writing · WilliamCole · 5 months ago Create captivating script ideas for your KZitem videos. Enter a short description of your video. Generates: Title, Scene, and Entire Script. 738.0K 421.5K 498 Keyword Strategy SEO / Ideation · AIPRM · 1 month ago GPT-3.5-turbo Create a keyword strategy and SEO content plan from 1 [KEYWORD] 1.1M 775.3K 463 Outrank Article SEO / Writing · AIPRM · 1 month ago GPT-3.5-turbo Outrank the competition with an in-depth, SEO-optimized article based on [YOUR COMPETITOR URL]. Be like your competition, just a little better ;-) 1.3M 918.3K 445 Add Public Prompt Prompts per Page 12 Showing 1 to 12 of 4020 Prompts Prev Next
Пікірлер: 1,2 М.