🔴 Get my Complete Frontend Interview Prep course - roadsidecoder.com/course-details Follow me on Twitter or you may fail in your interview 🤓 - twitter.com/piyush_eon If this video gets good response, I will make more JS interview videos, so do share it with others 🔥
Var and let can be declared without intialization Var and let can be updated but const cant be -there are 2 phases involved creation and execution . I creation window object is created then heap memory is allocated and then we initialise functions and variables with undefined (the whole function is stored inside the window object) . In execution the code is executed line by line and assigns variables . -Hoisting : during creation phase js engine moves function declarations and variable to top of the code -var variables are obv hoisted let variables are not (in normal sense they are hoisted in temporal dead zone) -temporal dead zone : a state in which let and const variables specifically are in scope but have not been declared yet .
I only studied what u said in this playlist I came here to tell u a very big Thanks ,3 months ago I got internship and I studied Java script from here Thanks a lot
You're truly the master of your craft! The content you've produced is exceptional; while many understand the theory, executing it practically is a whole different level, and you've accomplished it admirably. My sincere respect and admiration for your work, sir! Keep spreading your expertise and help around the globe 🌐
I was checking your videos from past 2 days and found your way of teaching and explanation of each and evry part in the video will clear every doubt. Excellent teaching, thanks and god bless you.
Best on RUclips... Better then akshay saini Previous used to watch akshsy saini for interview preparation and recalling basics of JS But your explanation is best in class
What is the difference between lexical scope and closure give us an example side by side like which line is removed then it's a lexical scope and which line is add then it's a closure
This the first question that I get asked everytime I give an interview for React JS. The first statement the interviewer makes is "Ok let's start with some basic questions, What is hoisting in JS 💥"
hello sir ...your way of teaching is in different level Thank you so much for that....please make some more videos on JS interviews questions. PLEASE PLEASE PLEASE.
Please make video on this challenge. I want to make a layout where there are header and main and main has multiple dynamic items of 150/150 px each. while making responsive screen, items should wraps in smaller size. header should always occupy width according to the items. for example if it has 1 item then header width should have 150px if 2 items then 300px and so on so forth.
Notes: Q) What is Scope? Ans: scope refers to the accessibility or visibility of variables, functions, and objects at different parts of the code during runtime. Scope determines where variables and functions can be accessed or referenced in your code. Type of Scope: Global Scope: Accessible everywhere in the code. Function Scope: Variables are only accessible within the function they are defined in.Var has functional scope. Block Scope: Variables declared with let or const inside a block are confined to that block. Lexical Scope: Inner functions have access to variables in their outer function's scope. Q) Varible shadowing? Ans: variable shadowing occurs when a variable declared in a certain scope has the same name as a variable declared in an outer or parent scope. The inner variable "shadows" or overrides the outer variable, meaning the inner variable is given precedence within its scope, and the outer variable becomes inaccessible from that inner scope. Q) var vs let vs const? Ans: Declaration var can be redeclared and let const can not. Declareation without initialisation var and let can declare but const can not Reintialisation: var and let value can reintialise but const value can not
I'm just now going through this playlist to prep for an interview that has a javascript knowledge section. your notes are super helpful btw but how did this playlist go for you use wise and practical wise
Just want to point out one thing, The declaration mentioned here is not same "declaring inside of your code", Your engine processes your variables in three steps: 1. Variable declaration (not same as decalaring a variable in the code) - Meaning defining the scope. Note that it does not mean that variable's memory has been decided also. 2. Variable assignment: Here Engine decides the memory for the variable and adds a default value for it. (default value: undefined) 3. Assignment: Assigning a value to the variable. Now which of the steps falls under Creation phase and Execution phases decided nature of the hoisting. For var, 1 & 2 happens in creation phase, hence even someone accessing it before the actual "declared in the code" gives you back "undefined" . For let and const: only one happens, 2 happens only when it hits the actual code declaration (let x, const r) so basically your variable have a scope but because assignment has not been done, It is said to be in TDZ (scope defined but not memory or default value)
@@wakeengineer check any of the below : - "variable lifecycle" article by dmitripavlutin - variable lifecycle course or course notes by Bogdan Stashchuk - JavaScript Visualized - Execution Contexts by Lydia Hallie
var or let may be updated, but const not var may be re-declare ,but not same with let or const var or let can be declare without initialization,but const can't
Please can you make system design for frontend developer series , By the way you taught amazingly. I watched the whole series is simply amazing 🤩. I love learn system design from you, that would be simply great
Let remains in tdz which is time period between declaration and intialization and let does not behaves as same as let because the undefined value goes in script not in window object that's y value of let can't be accessed before intialization
Good tutorial dude, what is your current package as a software developer. Just curious because I want to be as good as you and was wondering where the max package would cap haha
Can you make videos related to dsa using JavaScript for the dsa round in frontend interviews - also give some idea about how to get frontend internship opportunity while in college. hoping for your reply :)
This is my second comment Plz make videos on react js because your explanation is amezing But your video out in 7-8 days gap plz make as soon as possible
Q1: 5( var can be initialized and declared as hoisting will bring the code to top of stack) Q2: 2,1 (var can be re-declared and re-initialized but let will print based on the block it is initialized)
Can you please cover promise dependency question. "How can we call multiple promises parallelly but result should be printed sequentially. Lets say we start 3 parallel promises A,B and C. But if Promise B resolve it should check if A has been resolved or not and if it not then it should wait to print its result. Similarly C will wait for B and A. "
// Parallel execution of all promises const [resultA, resultB, resultC] = await Promise.all([promiseA, promiseB, promiseC]); // The below line will be executed only when all promises are resolved console.log(resultA, resultB, resultC);
5:10 - let-let can't be shadowed it will give a error. Try it out. Please verify all the information that you show in the video as its a placement video and students will get misguided.
HI, i have a table which has 3rows and 20cloumns, onclicking edit, first cell of that row should get highlighted , but last cell is getting highlighted . what can be done ..pls suggest
I came cross one hoisting interview question. Where variable declared with var and function declaration has same name, then which one of them will be hoisted? function test(){ return abc; function abc(){} var abc = 5; } console.log(typeof test()) Ans: function
if I write like this then: let z = 10; function abc() { console.log(z, 'z'); } abc(); Then , here let treating as a global var and also accesible anywhere, can you explain about this one?
In JavaScript, when a function is executed, the interpreter searches for variables in the current scope. If it doesn't find the variable within the function, it moves outward (to the next scope, and so on) until it finds the variable or reaches the global scope. Since z is declared with let in the global scope, and there's no local variable z inside the function abc(), JavaScript successfully finds the global z and uses its value (10) when you invoke the function.
Reassigning/redeclaring const objects (key pair values) and how to modify them is quite an important topic to understand I guess. The reason being a const variable is not strictly a constant Thanks for the great video brother
🔴 Get my Complete Frontend Interview Prep course - roadsidecoder.com/course-details
Follow me on Twitter or you may fail in your interview 🤓 - twitter.com/piyush_eon
If this video gets good response, I will make more JS interview videos, so do share it with others 🔥
Man Could u mak a site wih redux (Multilanguage) Please just one shoopping site
I need your help please
Var and let can be declared without intialization
Var and let can be updated but const cant be
-there are 2 phases involved creation and execution . I creation window object is created then heap memory is allocated and then we initialise functions and variables with undefined (the whole function is stored inside the window object) . In execution the code is executed line by line and assigns variables .
-Hoisting : during creation phase js engine moves function declarations and variable to top of the code
-var variables are obv hoisted let variables are not (in normal sense they are hoisted in temporal dead zone)
-temporal dead zone : a state in which let and const variables specifically are in scope but have not been declared yet .
I only studied what u said in this playlist I came here to tell u a very big Thanks ,3 months ago I got internship and I studied Java script from here Thanks a lot
bhai kase milye . how you applied share some insights
Hy piyush,
Your java script interview series much more helpful to crack React interviews.
I got selected more than 4 companies.
Thanks.
Congratulations Paras!
will it help in nodejs interviews aswell ?
You're truly the master of your craft!
The content you've produced is exceptional; while many understand the theory, executing it practically is a whole different level, and you've accomplished it admirably. My sincere respect and admiration for your work, sir!
Keep spreading your expertise and help around the globe 🌐
I was checking your videos from past 2 days and found your way of teaching and explanation of each and evry part in the video will clear every doubt.
Excellent teaching, thanks and god bless you.
This video deserves so much more engagement. Your content is really comprehensive. I signed in just to thank you lol. Keep up the good work!
Welcome aboard!
6:04 - You explained the concept of re-assigning new values not re-initialisation.
Amazing explanation of var, let and const.
This is awesome 👏🙌
If you will make like this videos series then no one can stop channel growth.♥️♥️
Please make such a content 🔥
🙏❤️
Amazing, you explain the content very well! I'm preparing for an interview that will happen next week, I hope I come back with good news! :)
Best on RUclips...
Better then akshay saini
Previous used to watch akshsy saini for interview preparation and recalling basics of JS
But your explanation is best in class
❣️
What is the difference between lexical scope and closure give us an example side by side like which line is removed then it's a lexical scope and which line is add then it's a closure
This the first question that I get asked everytime I give an interview for React JS. The first statement the interviewer makes is "Ok let's start with some basic questions, What is hoisting in JS 💥"
Yes, It helps interviewer evaluate your basics.
Hello Piyush,
AMAZING content. Exceptional way of explaining it.
Loved it.
Please make videos on
Classes and
Design Patterns. as well.
hello sir ...your way of teaching is in different level Thank you so much for that....please make some more videos on JS interviews questions. PLEASE PLEASE PLEASE.
Thank you so much Mayank! U made my day.
Amazing explanation Piyush !! Please bring more questions on JS interview!! Keep up the good work
During the creation phase JavaScript engine moves your variables and functions declarations on the top of your code and this is known as hoisting.
Thanks
Please make a series of JavaScript interview questions🙏
Yes I will!
I think there is a really good playlist. I got a 10 lpa offer from his videos. ruclips.net/p/PLKhlp2qtUcSaCVJEt4ogEFs6I41pNnMU5
@@RoadsideCoderhave you did full video of javascript questions?
very nicely explained thanks piyush
bro no other utuber explained shadow concept i got that topic from one of interviews thx!
Very helpful thank u sir explain very good i like it and understand all method thank so much
Bestest Playlist❤
thanks for the video ,the video was really good to understand the concepts clearly.
Thanks for making it so crystal clear thanks it helped a lot ❤
Please make video on this challenge.
I want to make a layout where there are header and main and main has multiple dynamic items of 150/150 px each. while making responsive screen, items should wraps in smaller size. header should always occupy width according to the items. for example if it has 1 item then header width should have 150px if 2 items then 300px and so on so forth.
10:47 -> ice-cream 🤣🤣
Great video btw 👍🏻
Hahah
Very perfectly explained ❤
interesting, I thought in ES6, the 'var' had been replaced by 'let', did not know there was this global / local meaning to it as well.
hi.. thank you so much for this js interview video. it helped me to pass the interview. all the best.
Congrats!
Enjoying all vedio i understand every topics clear more and doubts 👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌 Thank and thankyou so much explanation 🔥🔥🔥
Thank you
please watch this video before going to interview , the psuedo kind of coding questions helps a lot in interview
you and akshay saini both are awesome
Man thanks a lot, you have been so helpful ❤.
God bless you
Notes:
Q) What is Scope?
Ans: scope refers to the accessibility or visibility of variables, functions, and objects at different parts of the code during runtime. Scope determines where variables and functions can be accessed or referenced in your code.
Type of Scope:
Global Scope: Accessible everywhere in the code.
Function Scope: Variables are only accessible within the function they are defined in.Var has functional scope.
Block Scope: Variables declared with let or const inside a block are confined to that block.
Lexical Scope: Inner functions have access to variables in their outer function's scope.
Q) Varible shadowing?
Ans: variable shadowing occurs when a variable declared in a certain scope has the same name as a variable declared in an outer or parent scope. The inner variable "shadows" or overrides the outer variable, meaning the inner variable is given precedence within its scope, and the outer variable becomes inaccessible from that inner scope.
Q) var vs let vs const?
Ans: Declaration var can be redeclared and let const can not.
Declareation without initialisation var and let can declare but const can not
Reintialisation: var and let value can reintialise but const value can not
I'm just now going through this playlist to prep for an interview that has a javascript knowledge section. your notes are super helpful btw but how did this playlist go for you use wise and practical wise
The topics covered in this playlist are very good and explanation is also very good.
Just want to point out one thing, The declaration mentioned here is not same "declaring inside of your code", Your engine processes your variables in three steps:
1. Variable declaration (not same as decalaring a variable in the code) - Meaning defining the scope. Note that it does not mean that variable's memory has been decided also.
2. Variable assignment: Here Engine decides the memory for the variable and adds a default value for it. (default value: undefined)
3. Assignment: Assigning a value to the variable.
Now which of the steps falls under Creation phase and Execution phases decided nature of the hoisting.
For var, 1 & 2 happens in creation phase, hence even someone accessing it before the actual "declared in the code" gives you back "undefined" .
For let and const: only one happens, 2 happens only when it hits the actual code declaration (let x, const r) so basically your variable have a scope but because assignment has not been done, It is said to be in TDZ (scope defined but not memory or default value)
That's some deep understanding , where you get to know all these ?
@@wakeengineer check any of the below :
- "variable lifecycle" article by dmitripavlutin
- variable lifecycle course or course notes by Bogdan Stashchuk
- JavaScript Visualized - Execution Contexts by Lydia Hallie
you understand it very well, you may want to step it up.
Thank you wary much for the explanation!☺️
great explaination. thanks....make videos on JS Classes
pls, upload more and more videos. it will help me with my upcoming interviews
Var a=0;
If(a) {
Console.log(a) ;
}
What will be the output?
nada se va a imprimir ya que el if hara una coerción de tipo sobre el cero como un falsy value y no ejecutara el codigó dentro de este condicional
you are an amazing tutor 😍
Thank you Piyush Sir for these amazing explanation of JS question ... please make a series of JS interview questions ..
Thanks for the appreciation 🙏 More such videos coming in this series 🔥
It's a lot of money for a course if it would 300 or 400 I would have enrolled in the course !!
Please upload videos fast of this series bhaiya...
Great course
Thank you for this 💙
really awesome video, thank you !
My pleasure!
var or let may be updated, but const not
var may be re-declare ,but not same with let or const
var or let can be declare without initialization,but const can't
Please make an In Depth Video on Temporal Dead Zone
Keep going I learn so much from you
🙏
Very nicely explained
excellent explanation ❤
you opened my third eye after this.
Haha
Please can you make system design for frontend developer series ,
By the way you taught amazingly.
I watched the whole series is simply amazing 🤩.
I love learn system design from you, that would be simply great
x=9
console.log(x)
let x
//since let is hoisted it will move to the top,gets declared and in next step gets a value assigned. then why there is error
Let remains in tdz which is time period between declaration and intialization and let does not behaves as same as let because the undefined value goes in script not in window object that's y value of let can't be accessed before intialization
@@PookieThisSide-d9c okk thanks.... U r doing MERN Stack?
@@lakshaychauhan380 no focusing on frontend
@@PookieThisSide-d9c but there are less opportunities in front end
Thanks for the videos bro, very helpful for us.
Good to know 🙏
Great for interview.
Continue this series...
More videos incoming 😎
great your teaching is too good sir please please make a tutorial on iterator and generator
your content is awesome
🙏
thanks bro after that follow msg at 6:00 I spended 30 min on twitter 😶
😂
great video man!😊
Thanks 🙏
Good explanation though! Are you going to do some Interview Questions related to React? It would help a lot!
Yes that's planned too!
Well looking forward for more
On the way!
👍👍
Good tutorial dude, what is your current package as a software developer. Just curious because I want to be as good as you and was wondering where the max package would cap haha
Can you make videos related to dsa using JavaScript for the dsa round in frontend interviews - also give some idea about how to get frontend internship opportunity while in college. hoping for your reply :)
This is my second comment
Plz make videos on react js because your explanation is amezing
But your video out in 7-8 days gap plz make as soon as possible
Bro I've made a lot of videos on react js on my channel. You can check them out.
Q1. a=5;
console.log(a);
var a;
Q2: function abc() {
var a = 1;
let b = 1;
{
var a = 2;
let b = 2;
}
console.log(a, b);
}
abc();
Q1: 5( var can be initialized and declared as hoisting will bring the code to top of stack)
Q2: 2,1 (var can be re-declared and re-initialized but let will print based on the block it is initialized)
Can you please cover promise dependency question. "How can we call multiple promises parallelly but result should be printed sequentially. Lets say we start 3 parallel promises A,B and C. But if Promise B resolve it should check if A has been resolved or not and if it not then it should wait to print its result. Similarly C will wait for B and A. "
I don't know why this comment has no reply from @RoadsideCoder
Hey, Yeah sure I'll cover it in my promises video!
// Parallel execution of all promises
const [resultA, resultB, resultC] = await Promise.all([promiseA, promiseB, promiseC]);
// The below line will be executed only when all promises are resolved
console.log(resultA, resultB, resultC);
Thank you bro.
done
except - shadowing
Completed ✅
5:10 - let-let can't be shadowed it will give a error. Try it out. Please verify all the information that you show in the video as its a placement video and students will get misguided.
Helpful ❤
Awesome really helpful! Please make videos on react interview preparation also.
Yes, soon!
great series 🙂
Thanks
where do you work bro?
Continue this series bro
For sure
HI, i have a table which has 3rows and 20cloumns, onclicking edit, first cell of that row should get highlighted , but last cell is getting highlighted . what can be done ..pls suggest
It would be very helpful if you can create interview coding ques series on Js
awesome bro
Well said
Cover javascript decorator function for debouncing.
Your voice is great
Thank you 🙏 Can I make a career as a voice artist? 👀
@@RoadsideCoder hope so
@@RoadsideCoder how can i start contributing in open for getting a remote job
@@danish7335 U don't need open source to get a remote job. Work on your skills and building a personal brand on social media
@@RoadsideCoder thnx for your valuable reply
I came cross one hoisting interview question.
Where variable declared with var and function declaration has same name, then which one of them will be hoisted?
function test(){
return abc;
function abc(){}
var abc = 5;
}
console.log(typeof test())
Ans: function
Thanks for sharing
Can u please explain it why
nice video. create more videos like this
Definitely
Thank you
Best videos
thanks a lot
Thanks for the great content, could I ask if these questions are asked on junior roles?
Yes!
@@RoadsideCoder thanks for your reply 🙏 I had my first interview today and your videos helped
@@meri8375 wow that's amazing dude!
Can you please make videos on Redux, reducers, and middleware for beginners?
I have made, you can check in my channel!
if I write like this then:
let z = 10;
function abc() {
console.log(z, 'z');
}
abc();
Then , here let treating as a global var and also accesible anywhere, can you explain about this one?
In JavaScript, when a function is executed, the interpreter searches for variables in the current scope. If it doesn't find the variable within the function, it moves outward (to the next scope, and so on) until it finds the variable or reaches the global scope.
Since z is declared with let in the global scope, and there's no local variable z inside the function abc(), JavaScript successfully finds the global z and uses its value (10) when you invoke the function.
Make a video on execution context and call back
Sure!
Please make series of important dsa questions too and design questions asked in interview
Ok brother
Bro i want to tecah my nephew software dev what shud he begins with first kindly guide?
Thanks bhai
Reassigning/redeclaring const objects (key pair values) and how to modify them is quite an important topic to understand I guess.
The reason being a const variable is not strictly a constant
Thanks for the great video brother
Welcome ❤️
the voice at 10:50 🤣🤣🤣
Creation phase me let ko undefined nhi milta sayad