Hi, Nice tutorial! I have a question that is troubling me a lot;
At 7:50 , const c; // Is c by default set to undefined or not?
becuase when i am directly doing just after writing const c;
console.log(c); // error I am getting: (Uncaught SyntaxError: Missing initializer in const declaration)
Why so?
And when I tried the same with let:
let c; console.log(c);// undefined I got!
Again when I myself initialize like below:
const c=undefined; console.log(c); //undefined is the answer
Kindly help in this regard!
And thank you very very much for your awesome awesome videos.
Humble Request: Please create a video series on react-redux saga, where you develop a full fledged website components in react-redux! I already completed your react-redux starter course! Please create some advanced stuff ๐
@techsith one more noticeable difference, can surprise a few folks, i.e., when we declare a variable using let in global scope, the variable doesn't become a property of the global object whereas variables declared with var would be present as a property on the global object..
var t = "Property On Global object";
let x = "Not a property on global object";
console.log(t); //"Property On Global object"
console.log(window.t); //"Property On Global Object"
console.log(x); //"Not a property on global object"
console.log(window.x); //undefined
Although both the variables can be accessed by inner scopes to the global and at the global scope itself, but the variable declared with let keyword won't be available as a property to the global object.
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?
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.
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!!
@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?
35 responses to “Top 10 JavaScript Interview Questions”
2morow is my interview as a web dev. intern, hopefully i will make it ๐
Man I feel stupid. I keep trying to learn JS, but it just seems bottomless.
It is very helpful for interviews.
Got the interview today, exactly the second question be asked. I hoped earlier to see this video! ๐ญ
Hi, Nice tutorial!
I have a question that is troubling me a lot;
At 7:50 ,
const c; // Is c by default set to undefined or not?
becuase when i am directly doing just after writing const c;
console.log(c); // error I am getting: (Uncaught SyntaxError: Missing initializer in const declaration)
Why so?
And when I tried the same with let:
let c;
console.log(c);// undefined I got!
Again when I myself initialize like below:
const c=undefined;
console.log(c); //undefined is the answer
Kindly help in this regard!
And thank you very very much for your awesome awesome videos.
Humble Request:
Please create a video series on react-redux saga, where you develop a full fledged website components in react-redux!
I already completed your react-redux starter course! Please create some advanced stuff ๐
89 people don't know Javascript.
Can you please create a video on document.getSelection
Thanks for answering all questions
Great videos
Great explanations!
When I run this code, both console statements output undefined, as opposed to what is explained in the video.
let x=function(){
if(true){
console.log(v);
console.log(l);
var v=2;
let l=1;
}
}
x();
@techsith one more noticeable difference, can surprise a few folks, i.e., when we declare a variable using let in global scope, the variable doesn't become a property of the global object whereas variables declared with var would be present as a property on the global object..
var t = "Property On Global object";
let x = "Not a property on global object";
console.log(t); //"Property On Global object"
console.log(window.t); //"Property On Global Object"
console.log(x); //"Not a property on global object"
console.log(window.x); //undefined
Although both the variables can be accessed by inner scopes to the global and at the global scope itself, but the variable declared with let keyword won't be available as a property to the global object.
For more, check – http://www.ecma-international.org/ecma-262/6.0/#sec-global-environment-records
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?
Null can be sent from an event
Thanks
Thank yo sir this was very helpful.
1 Explain let,var and const variable declaration and explain their scope .what is strict mode?
2 What are callbacks and callback hell in javascript . What are higher order functions?
3 What is hositing in javascript ?
4 What are prototypes and explain Prototypal inhertiance ?
5 What are Closures in javascript?
https://truetocode.com/top-10-javascript-interview-questions-concepts-every-javascript-developer-should-know/839/
this is so good and a lot of help. thank you!
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
Really helpful. Thanks a lot!
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.
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!!
@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?
who got udemy ad too ?
thanks for vid learnt lots
Plz upload series on angular6
i they asked me 3 same questions.. just completed phone interview.. and it went not that bad thanks to you ๐๐ป
Thanks for the great videos! Just wanna ask is the questions and answers have a PDF version? Many thanks!
Thank you for the videos ๐
where do we need to place the refrence table file on nformatica server?
very helpfull video, thanks
can you tell me how we will prove that javascript is a scripting language?
Only function object has "prototype" property not all object.
You create very informative videos with examples that serve to illuminate rather than confuse the concepts at hand. Keep up the good work.
is this a joke or are These Questions for real? ;))