what is the difference between "var" and "let" keywords? 1:15 what is the difference between "==" and "===" signs? 3:54 what is the difference between "let" and "const" keywords? 6:02 what is the difference between "undefined" and "null" keywords? 9:06 what is use of Arrow function? 10:01
Today I got a job offer from an amazing company after passing their javascript interview questions. Luckily I watched your videos shortly before the interview which contained several of the questions you answered in your videos. Thank you techsith!
I am unable to get how in the last example it would set it to window object. It is using splitname's this which does not have firstname property so it should throw an error.
thank you for the video! but I should point that both "let" and "var" are both always hoisted. The difference is that let gets hoisted to the block scope and remains uninitialized , that's why we get an error if we try to access it before its assignment. This is known as the "temporal dead zone". The same happens with "const".
let and const keywords are not hoisted, but temporarily declared in the temporal dead zone, until they are initialized. To be precise, TDZ is the actual reason that contradicts the concept of hoisting in case of both keywords. TDZ is a fascinating topic for newbies, but one must understand its depth and absoluteness.
dude i highly respect you from the bottom of my heart . you are what they call an expert . i have request that please keep uploading such informative videos. thank you
sir what is the difference between callback function and promise .. they both run a function after they finish one.. let me try difference then you can correct me if I am Wong ..in callback function we can pass the argument of the previous function where as promise functions are independent functions. please reply
Update from 2021: 2:28 - Incorrect statement. Variables declared with let and const get hoisted as well. They just do not get initialized in the same way as with var.
Excellent. I recently got a job which included Javascript. It was obvious to me that the interviewer watched this video. He tried to stump me and asked 6 of the questions. Thanks because I watched this video at least 10 times 👍
Just some addition. Arrow functions also do not have their own arguments, the value of arguments for arrow functions are taken from the outer lexical environment.
In the second question (==/===) you are talking about effect of the comparison of these 2 operators not about them functionallity. Double equal sign also compare type but before it makes type coercion. Thats why === sign is faster than == sign.
Exactly, it's disheartening to see how many interviewers get this simple thing wrong. It denotes a lack of understanding on other parts of the language as well.
1) what is the difference between "var" and "let" keywords? : Var is with us since the beginig of js whereas dlet was introduced in js with es6 version of js, Other difference between var and let is that var has function scope and let has a block scope other diff Var can be hoisted at the top of its function where let doesnt get hoisted(ie let doesnt exist before its definition and exists from its definition till the end of the block) eg. if(true){ console.log(v) --->undefined console.log(l) --->error var v=1; let l=2; } 2)what is the difference between "==" and "===" signs? 3:54 Both of these are comparison operators, but == will compare just the value and ignore type, whereas === will compare value and type eg. if("3"==3) ==>true if("3"===3) ===>false 3)what is the difference between "let" and "const" keywords? you can not reassign const value, whereas for let you can even change its type, but in array const a=[1,2,3] a.push(4) is allowed a wil be a=[1,2,3,4] but you can not reassign it as a=[1,2,3,4] 4)what is the difference between "undefined" and "null" keywords? When you define a variable but do not assign any value to it, js automatically assigns a placeholder to it as undefined(ie we do not assiign it as undefined) Whereas when we want to clean a value we would set it to null another imp diff is if we do console.log(typeof(undefined))--->undefined console.log(typeof(null))--->object
Hello, this video is really useful thank you for sharing it :) I've got a question: at 7:25 if you say that if we write “const c;” JavaScript will assign “undefined” to our constant why if we console.log(c) is returns: “Missing initialiser……” ? [shouldn’t it return “undefined” if we console.log(c)?] What does “Missing initialiser really mean"? That we’ve not assigned a value to our const yet?
As far as I understand, when we use the keyword “const” while declaring a variable, an initialiser for the constant is required. We cannot just declare a variable with const we need to assign a value to it, isn’t it?
Some questions from my interviews: 1. How would you describe that even bubbling works? 2. calc(1)(2) returns 3. How would you write that function? 3. What do you know about ES7? 4. What is a callback function and how would you write it? 5. Adding an array to another array without using push. How would you do it?
Variables defined with let do get hoisted but they enter a time called temporal dead zone. When we declare a variable using var and try to print its value without assigning anything to it,it gives undefined as the output. But when we do the same thing using let it gives error. The time between assigning the value to be undefined and output is called as the temporal deadzone
Nice video to augment all of the other great videos you create. One thing I noticed, and this is a technicality. When describing the difference between 'let' and 'var', you state that the definition of a 'var' is hoisted, but not the value. What you meant to say (I am certain) is that the DECLARATION is hoisted and not the definition. This is an important clarification that needs to be made. Keep up the good work!!
@@Techsithtube please reply please I am learning web dev by my own so please reply Want to become frontend Leatnt html css bootstrap facing problem in js Please reply what topics I need to know for web dev or I need to learn whole Ple as per frontend web role
The difference between let and var is that , let's say that we will made a function , between we will made variable and there we will write "Hello world ".In the console will be a mistake because the visibility area of the let is in {} . Var has the global visibility and the local visibility , we can change the value of this varieble .This is simple question , but allright
I know this is gonna get lost in a sea of comments but I just wanted to let you know that I passed my first co-op job javascript interview because of your videos! Thanks for everything! :)
awesome video..thank you sir...but i observed one thing at time 7:58. the error stating “missing initialiser” it means when you declared the const at that time only you need to initialise it. It does not considers “undefined” as initialised value otherwise it would show “reassignment is not allowed” to const. please bridge the gap if it is so...
Contrary to what you said, let and const are also hoisted to the top of the scope but without initialization and accessing it before initializing will throw a Reference Error.
Well if you look at that way. there is no such thing as hoisting. Hoisting is the word created by JavaScript community to explain the odd behavior of var. Its just way javaScript interpreter looks at things.
All declarations (function, var, let, const and class) are hoisted in JavaScript, while the var declarations are initialized with undefined, but let and const declarations remain uninitialized. They will only get initialized when their lexical binding (assignment) is evaluated during runtime by the JavaScript engine. This means you can’t access the variable before the engine evaluates its value at the place it was declared in the source code. This is what we call “Temporal Dead Zone”, A time span between variable creation and its initialization where they can’t be accessed.
A const declaration must have an explicit initialization If you want a const with the undefined value, you'd have to declare const c = undefined to get it. const c alone will throw a SyntaxError: Missing initializer in const declaration Reassign will throw TypeError: Assignment to constant variable.
I had an interview yesterday where I was asked about let and const and i also had the undefined and null question ... a new one for me was 'explain what promises are in javascript'
Hello, I have a quick question. Variables defined with 'let' are also hoisted. It's just that their initialisation to 'undefined' is not done in case of 'let'. Correct me If I am wrong. Thanks
Actually both the comparison operators "==" and "===" compare types and values both. The difference is the former allows dynamic type coercion and latter does not. Good video though, correct me if i am wrong :)
2:26 You said Let does not get hoisted. Where as it get hoisted and it will be in a temporal dead zone if you try to console it before initialization .
getting temporal dead zone and hoisting is two different things. if you call variable before its definition it should give you and error. in case of let that is true. var will give you undefined instead of error. because its declaration is hoisted , not the value. Temporal dead zone is because if you define the same variable outside the block.
Okay hold on, I have a question. 11:10 What's the purpose of the second function inside of the other? A code like this: // setName : function(name) { // let nameArray = name.split(' '); // this.firstName = nameArray[0]; // this.lastName = nameArray[1]; // } would have the same effect, right? So what was that about?
Yuriy, this is just an interview question however in reality you may have a large method with duplicate functionality which you can abstract out to a common function.
Thanks for your for the video, but you mentioned that let isn't hoisting. But var, let and const they are all hoisted to the top of their scope. But while var variables are initialized with undefined, let and const variables are not
Today they asked about, diff between undefined and null, var and let, function scoped vs block scoped, how to display keys from object, how to delete keys from object, how to sort by name
Very Useful !!!! Please create videos on below topic (ECMA-2015) Modules Value Export/Import Default & Wildcard Classes Class Definition Class Inheritance From Expressions Base Class Access Static Members Getter/Setter
+31redorange08 dude he probably tried everything 5 times in the console before making the vid to be 100000% sure about everything. So i guess he is right xD
let gets hoisted as well const get hoisted as well! They get hoisted differently that's all.Tthey go to the temporal dead zone and if you call them before the compiler reaches the variable you will get a reference error
Hoisting is what allows you to use a variable before its declared in a scope... you should go look up a definition of javascript hoisting to understand what it means :)
9:25 I was told that "defining a variable" and "assigning a value to a variable" were the same thing? And that "declaring a variable" was just creating the existence of a variable, with or without a value e.g. var x; Where did I go wrong?
Jeff Donald you’re thinking of declaring a variable. Saying var foo; is declaring it but also technically defining it As undefined. Hope that makes sense...
I am unable to get how in the last example it would set it to window object. It is using splitname's this which does not have firstname property so it should throw an error.
3:54 The difference between "==" and "===" is wrong. Both check for type. The difference is that "==" attempts coercion, while "===" doesn't attempt coercion on your values.
He never said that one of them doesn't check for type. He said the "==" operator checks for type while the "===" operator checks for both value and type... which is correct.
He actually said the double equals does not check for type, which is incorrect. The first thing they both do is check for type. with === If the types are !=, then it returns false. With == if the types are the same, then it proceeds to process based on the strict equality rules. If not, it goes through a bunch of coercion steps to return true or false.
Thanks for sharing watching your other videos, the one that has this example console.log(7 > 6 > 5 ), console.log(5 < 6 < 7 ), made me think and and I just checked that console.log(true == 1) true as u said but also console.log(false == 0) --> true
blog.campvanilla.com/javascript-the-curious-case-of-null-0-7b131644e274 This might be helpful. tl;dr it's because of the algorithm that javascript uses when dealing with relational operators
I think the concept you told about 'let' is not true at some point. let are also hoisted but since js allocate completely different memory for let and we can't access those variables from that memory block before initialisation. Hence the error
I like your concepts involved for preparation on Interview questions for Front-End User and other formats of interview questions. Being that I am refreshing my skills back into Technology filled, I finds these types of questions very helpful. Thank You!
@techsith Thanks for the informative explanation. Regarding the difference between let and const, what is the purpose of 'if (true) { ... }'. Is to mimic a function scope?
One more difference between var and let is var can also be re-declared and let can not. I think the whole reason const and let were brought in with es6 was to try and take away some of the flexibility of declaring variables when it comes to mutability. We still have mutability with let but it is MUCH more controlled now. You really shouldn't use var.. but if you insist at the very least "use strict" because things like hoisting and unwanted mutability can get you in trouble.. also strict mode won't always save you. You can redeclare variables in it... awful.
Hi Techsith could you please explain following code ?? I have been asked in one of the interviews for the output - function parent() { var numOne = 1; function child(){ var numTwo = 2; } console.log("numOne and numTwo are ", numOne , numTwo ); } parent(); Thanks in advance
what is the difference between "var" and "let" keywords? 1:15
what is the difference between "==" and "===" signs? 3:54
what is the difference between "let" and "const" keywords? 6:02
what is the difference between "undefined" and "null" keywords? 9:06
what is use of Arrow function? 10:01
Not all heroes wear suit.. Thanks :)
Thanks, I already know all of these answers so you saved me some time.
Thanks
Tutorial turns out to be a giant tutorial 11:47
Tutorial turns out to be a giant tutorial 11:58
@@ChristopherElwell lol
Today I got a job offer from an amazing company after passing their javascript interview questions. Luckily I watched your videos shortly before the interview which contained several of the questions you answered in your videos. Thank you techsith!
Great News Shay 👍 , I am happy for you. Work hard and you will be successful.
@shay Hawking what will know to clear javascript interview for freshers
Congratulations
please add your questions here.. it'll help a lot
:)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
i they asked me 3 same questions.. just completed phone interview.. and it went not that bad thanks to you 🙌🏻
I am unable to get how in the last example it would set it to window object.
It is using splitname's this which does not have firstname property so it should throw an error.
Ppppp
Ppppppp
thank you for the video!
but I should point that both "let" and "var" are both always hoisted. The difference is that let gets hoisted to the block scope and remains uninitialized , that's why we get an error if we try to access it before its assignment. This is known as the "temporal dead zone". The same happens with "const".
let and const keywords are not hoisted, but temporarily declared in the temporal dead zone, until they are initialized. To be precise, TDZ is the actual reason that contradicts the concept of hoisting in case of both keywords. TDZ is a fascinating topic for newbies, but one must understand its depth and absoluteness.
Thanks to your Interview Questions video, it prepped me to land multiple Web Development jobs. I really appreciated it.
😜😜😜😜😜😜 sarcasm at its best
dude i highly respect you from the bottom of my heart . you are what they call an expert . i have request that please keep uploading such informative videos. thank you
Those are the basics of JavaScript and a must know for everyone firsthand even before writing your first logical JavaScript program.
Started learning javascript couple months ago and this is quite helpful, thank you! (Especially the arrow)
Let and const also gets hoisted not only var
sir what is the difference between callback function and promise .. they both run a function after they finish one.. let me try difference then you can correct me if I am Wong ..in callback function we can pass the argument of the previous function where as promise functions are independent functions. please reply
Finally after 10 videos I watched your and learned what closure is :)
Update from 2021:
2:28 - Incorrect statement. Variables declared with let and const get hoisted as well. They just do not get initialized in the same way as with var.
Akshay saini😎
Excellent. I recently got a job which included Javascript. It was obvious to me that the interviewer watched this video. He tried to stump me and asked 6 of the questions. Thanks because I watched this video at least 10 times 👍
I am glad Charles you were able to answer the questions. Did you get the job?
techsith Yes i did, thanks again.
Just some addition. Arrow functions also do not have their own arguments, the value of arguments for arrow functions are taken from the outer lexical environment.
Thank you for explaining after each question! This video is 5 Years old but still awesome!
In the second question (==/===) you are talking about effect of the comparison of these 2 operators not about them functionallity. Double equal sign also compare type but before it makes type coercion. Thats why === sign is faster than == sign.
Exactly, it's disheartening to see how many interviewers get this simple thing wrong. It denotes a lack of understanding on other parts of the language as well.
Could you explain bit more
He eludes to that around 5:20
1) what is the difference between "var" and "let" keywords?
: Var is with us since the beginig of js whereas dlet was introduced in js with es6 version of js,
Other difference between var and let is that var has function scope and let has a block scope
other diff
Var can be hoisted at the top of its function where let doesnt get hoisted(ie let doesnt exist before its definition and exists from its definition till the end of the block)
eg.
if(true){
console.log(v) --->undefined
console.log(l) --->error
var v=1;
let l=2;
}
2)what is the difference between "==" and "===" signs? 3:54
Both of these are comparison operators, but == will compare just the value and ignore type, whereas === will compare value and type
eg.
if("3"==3) ==>true if("3"===3) ===>false
3)what is the difference between "let" and "const" keywords?
you can not reassign const value, whereas for let you can even change its type, but in array
const a=[1,2,3]
a.push(4) is allowed
a wil be a=[1,2,3,4]
but you can not reassign it as a=[1,2,3,4]
4)what is the difference between "undefined" and "null" keywords?
When you define a variable but do not assign any value to it, js automatically assigns a placeholder to it as undefined(ie we do not assiign it as undefined)
Whereas when we want to clean a value we would set it to null
another imp diff is if we do
console.log(typeof(undefined))--->undefined
console.log(typeof(null))--->object
Got the interview today, exactly the second question be asked. I hoped earlier to see this video! 😭
Good luck I hope you get the job. :)
no reply that means no job
@@deepanshu2015 🤣🤣
Hello, this video is really useful thank you for sharing it :) I've got a question: at 7:25 if you say that if we write “const c;” JavaScript will assign “undefined” to our constant why if we console.log(c) is returns: “Missing initialiser……” ?
[shouldn’t it return “undefined” if we console.log(c)?]
What does “Missing initialiser really mean"? That we’ve not assigned a value to our const yet?
As far as I understand, when we use the keyword “const” while declaring a variable, an initialiser for the constant is required. We cannot just declare a variable with const we need to assign a value to it, isn’t it?
Thanks alot my Pakistani friend!
I got my first IT interview ever tomorrow, wish me luck!
Good Luck with your interview.
Some questions from my interviews:
1. How would you describe that even bubbling works?
2. calc(1)(2) returns 3. How would you write that function?
3. What do you know about ES7?
4. What is a callback function and how would you write it?
5. Adding an array to another array without using push. How would you do it?
An instance of bubbling is when a click on a button nested inside a parent(div) that also has an on click event reacts to that click
So the way to stop the propagation is by using the stopPropagatjon method
No 5
Use the spread operator
Eg
... SecondArray
@@amakauwa9724 Would .concat be acceptable too?
yoooo got any more of those? Questions like these are addicting haha
Variables defined with let do get hoisted but they enter a time called temporal dead zone. When we declare a variable using var and try to print its value without assigning anything to it,it gives undefined as the output. But when we do the same thing using let it gives error. The time between assigning the value to be undefined and output is called as the temporal deadzone
You create very informative videos with examples that serve to illuminate rather than confuse the concepts at hand. Keep up the good work.
Nice video to augment all of the other great videos you create. One thing I noticed, and this is a technicality. When describing the difference between 'let' and 'var', you state that the definition of a 'var' is hoisted, but not the value. What you meant to say (I am certain) is that the DECLARATION is hoisted and not the definition. This is an important clarification that needs to be made. Keep up the good work!!
Good point. I will point that out in the description . Thanks for watching!
I love your content. I have a Front End technical interview this week - thank you so much for the great content to hep me prepare!
Good luck with your interview!
@@Techsithtube please reply please
I am learning web dev by my own so please reply
Want to become frontend
Leatnt html css bootstrap facing problem in js
Please reply what topics I need to know for web dev or I need to learn whole
Ple as per frontend web role
I'm currently interviewing for new roles. Thanks for the tips.
The difference between let and var is that , let's say that we will made a function , between we will made variable and there we will write "Hello world ".In the console will be a mistake because the visibility area of the let is in {} . Var has the global visibility and the local visibility , we can change the value of this varieble .This is simple question , but allright
I know this is gonna get lost in a sea of comments but I just wanted to let you know that I passed my first co-op job javascript interview because of your videos! Thanks for everything! :)
awesome video..thank you sir...but i observed one thing at time 7:58. the error stating “missing initialiser” it means when you declared the const at that time only you need to initialise it. It does not considers “undefined” as initialised value otherwise it would show “reassignment is not allowed” to const.
please bridge the gap if it is so...
3:21 Not its 'definition', its 'declaration'. If its definition was also hoisted, it wouldn't be undefined.
Contrary to what you said, let and const are also hoisted to the top of the scope but without initialization and accessing it before initializing will throw a Reference Error.
Well if you look at that way. there is no such thing as hoisting. Hoisting is the word created by JavaScript community to explain the odd behavior of var. Its just way javaScript interpreter looks at things.
@@Techsithtube And here I thought I had that concept figured out. 😁 Much appreciated anyhow. Your content is very helpful. Hats off to you. 👏👏
There is something called temporal dead zone for let and const
All declarations (function, var, let, const and class) are hoisted in JavaScript, while the var declarations are initialized with undefined, but let and const declarations remain uninitialized.
They will only get initialized when their lexical binding (assignment) is evaluated during runtime by the JavaScript engine. This means you can’t access the variable before the engine evaluates its value at the place it was declared in the source code. This is what we call “Temporal Dead Zone”, A time span between variable creation and its initialization where they can’t be accessed.
Eloquent Techsith :)
Thanks for watching!
A const declaration must have an explicit initialization
If you want a const with the undefined value, you'd have to declare const c = undefined to get it.
const c alone will throw a SyntaxError: Missing initializer in const declaration
Reassign will throw TypeError: Assignment to constant variable.
Thank you, this is really helping! WISH ME LUCK MY BROTHERS
Thanks for watching!
I had an interview yesterday where I was asked about let and const and i also had the undefined and null question ... a new one for me was 'explain what promises are in javascript'
wtf is that
@@vracaze you'll learn it
i wish i had gone through this before, every single question were asked in my last interview, you rock !
in india?
Nagendra Patchikoru yea
Hello,
I have a quick question. Variables defined with 'let' are also hoisted. It's just that their initialisation to 'undefined' is not done in case of 'let'. Correct me If I am wrong. Thanks
I too was wondering with this....Let and const are also hoisted but they are in temporal dead zone
Actually both the comparison operators "==" and "===" compare types and values both. The difference is the former allows dynamic type coercion and latter does not.
Good video though, correct me if i am wrong :)
Variable defined as let also get hoisted but not on a global execution context but in seprate space
2:26 You said Let does not get hoisted. Where as it get hoisted and it will be in a temporal dead zone if you try to console it before initialization .
getting temporal dead zone and hoisting is two different things. if you call variable before its definition it should give you and error. in case of let that is true. var will give you undefined instead of error. because its declaration is hoisted , not the value. Temporal dead zone is because if you define the same variable outside the block.
Okay hold on, I have a question. 11:10 What's the purpose of the second function inside of the other? A code like this:
// setName : function(name) {
// let nameArray = name.split(' ');
// this.firstName = nameArray[0];
// this.lastName = nameArray[1];
// }
would have the same effect, right? So what was that about?
Yuriy, this is just an interview question however in reality you may have a large method with duplicate functionality which you can abstract out to a common function.
Loved it sir. Big fan of yours.
Thanks for your for the video, but you mentioned that let isn't hoisting. But var, let and const they are all hoisted to the top of their scope. But while var variables are initialized with undefined, let and const variables are not
you explains the concepts in a understandable way😊..thank you bro
Happy to help! feel free to ask more questions ! :)
Technically, all JS variables are hoisted. Where let and cost differs from var in the hoisting process is in the initialization part
Just an additional info for arrow functions, regular functions are hoisted while arrow functions are not.
You are amazing at explaining things, thank you
Best Javascript teacher on UA-cam.
Thanks :)
JS interview series: ua-cam.com/video/VcPH4FSxc7Y/v-deo.html
helped alot... waiting for part3...😃😃
Great demonstration of using arrow function. Thanks man for teaching it.
Really concise and on spot!
Today they asked about, diff between undefined and null, var and let, function scoped vs block scoped, how to display keys from object, how to delete keys from object, how to sort by name
I hope you were able to answer the questions. Good luck with your interviews.
Very Useful !!!!
Please create videos on below topic (ECMA-2015)
Modules Value
Export/Import
Default & Wildcard
Classes
Class Definition
Class Inheritance
From Expressions
Base Class Access
Static Members
Getter/Setter
THanks for the list. I will sure to create those tutorials .
Very useful information!
Tomorrow is my first interview for a Jr. Software Developer position. Wish my luck!
Techsith kaka🙌
As per my understanding Let have functional and block scope and var have global scope and functional scope.
Great video...Really knowledgeable 🙂
Good video. Except const c; is not assigned a value of undefined. It throws error.
Yes in the latest broser const c; would give error.
I call bullshit. The error message is clear. The behavior didn't change since you uploaded the video. Just admit it.
+31redorange08 dude he probably tried everything 5 times in the console before making the vid to be 100000% sure about everything. So i guess he is right xD
what do you think "missing initializer" means?
@@31redorange08 fuck you and stop harassing someone who put work into a video to help us, idiot
Thank you for the video, it is awesome.
Thank you for the examples with each question. This is an excellent video!!
let gets hoisted as well const get hoisted as well! They get hoisted differently that's all.Tthey go to the temporal dead zone and if you call them before the compiler reaches the variable you will get a reference error
you made me know some of the little things i had always assumed;
actually let get hoisted, just doesn't allow you to use it before it was "declared" in the scope
Hoisting is what allows you to use a variable before its declared in a scope... you should go look up a definition of javascript hoisting to understand what it means :)
5:30 i think string will be converted to number right ?
This was so helpful! Thank you!!!!!
Thank you so much! Really love the quality of content you are providing for us!
9:25 I was told that "defining a variable" and "assigning a value to a variable" were the same thing? And that "declaring a variable" was just creating the existence of a variable, with or without a value e.g. var x;
Where did I go wrong?
Jeff Donald you’re thinking of declaring a variable. Saying var foo; is declaring it but also technically defining it As undefined. Hope that makes sense...
You said you shouldn't manually assign a variable undefined, just curious what the reason is behind it?
I am unable to get how in the last example it would set it to window object.
It is using splitname's this which does not have firstname property so it should throw an error.
3:54 The difference between "==" and "===" is wrong. Both check for type. The difference is that "==" attempts coercion, while "===" doesn't attempt coercion on your values.
He never said that one of them doesn't check for type. He said the "==" operator checks for type while the "===" operator checks for both value and type... which is correct.
He actually said the double equals does not check for type, which is incorrect. The first thing they both do is check for type. with === If the types are !=, then it returns false. With == if the types are the same, then it proceeds to process based on the strict equality rules. If not, it goes through a bunch of coercion steps to return true or false.
Your teaching amazing..
Manoz, thank you for watching! :)
best javascript i learn
You are a legend, I was working on a project where I couldn't find the solution but it was simply instead of ===, use ==. 😂😂
I am glad it was helpful.
The let variable is also hoisted , why it does not print undefined answer to it is temporal dead zone concept , I guess you have to rectify that
Thanks for sharing watching your other videos, the one that has this example console.log(7 > 6 > 5 ), console.log(5 < 6 < 7 ), made me think and and I just checked that console.log(true == 1) true as u said but also console.log(false == 0) --> true
this is so good and a lot of help. thank you!
starts at 1:15
I have a question which are regarding to comparison operator,
null>0 --> false
null==0 -->false
null===0-->false
null>=0-->true ?Why ? How ?
blog.campvanilla.com/javascript-the-curious-case-of-null-0-7b131644e274
This might be helpful. tl;dr it's because of the algorithm that javascript uses when dealing with relational operators
Thank you so much sir ❤️
"You ever hear the Tragedy of Darth Plagueis The Wise"
Immediately thought about this when I read "tech sith" lol
Lol. I am a big star wars fan. :)
Wonderful... Very Clear and well explained.
THank fro watching!
wow JavaScript never been so easy to understand before
your videos are amazing! and so are you, sir!
@02:18 Variables declared with let don't get hoisted? I thought they did get hoisted.
Thank you so much!!!Can someone suggest me from where I should learn javascript from basic to advance.
Great job buddy. You have a good presentation skill..
very nice explanation of each question with the example.
Thanks for watching:)
These questions really made sense... thanks :)
I think the concept you told about 'let' is not true at some point. let are also hoisted but since js allocate completely different memory for let and we can't access those variables from that memory block before initialisation. Hence the error
Really helpful. Thanks a lot!
Thanks for watching Weijuan!
11:15 what if we use var insted of let will it again set the window object
if you use var instead of let there. you will have to bind to the object to use it.
Let is also hoisted only difference is it goes to temporal dead zone
I like your concepts involved for preparation on Interview questions for Front-End User and other formats of interview questions. Being that I am refreshing my skills back into Technology filled, I finds these types of questions very helpful. Thank You!
Great video Techsith - thanks!
Thanks for watching!
Hi indeed explain for this..var array=[1,2,3]; var [a=2,b]=array; console.log(a+""+b);. Op is 12
Madhan was this asked in an interview? its very simple [1,2,3] = [a,b] here a=1, b=2 so a+ "" + b = 12
@@Techsithtube yep...
How it comes..[1,2,3]=[a,b]
a=2 is just default param, which means if a is null a=2 but here [1,2,3] = [a,b] so a = 1, b=2
@@Techsithtube thanks bro
@techsith Thanks for the informative explanation. Regarding the difference between let and const, what is the purpose of 'if (true) { ... }'. Is to mimic a function scope?
if(true) {} creates a block scope. you can only create function scope by using a function.
One more difference between var and let is var can also be re-declared and let can not. I think the whole reason const and let were brought in with es6 was to try and take away some of the flexibility of declaring variables when it comes to mutability. We still have mutability with let but it is MUCH more controlled now. You really shouldn't use var.. but if you insist at the very least "use strict" because things like hoisting and unwanted mutability can get you in trouble.. also strict mode won't always save you. You can redeclare variables in it... awful.
This is not the case.
Perfectly explained!
Hi Techsith could you please explain following code ?? I have been asked in one of the interviews for the output -
function parent() {
var numOne = 1;
function child(){
var numTwo = 2;
}
console.log("numOne and numTwo are ", numOne , numTwo );
}
parent();
Thanks in advance
mumTwo is inside child() so its not accessed outside to you will get numTwo is not defined error.