0:33 - what is prototypal inheritance 2:58 - what is the difference between function declaration & function expression 4:21 - what is promises and why do we use it 6:43 - setTimeout() 8:23 - what is closure and how do we use it
Nice tutorial before appearing for JS interview. I had gone through a few interviews and was asked most of these questions and also them: 1. Spread Operator 2. Bind, Call, Apply in JS 3. Array Questions (deep copy and shallow copy of array using assign;also map property used many a times) 4. Ques based on Object Keys Hope it helps! (I would appreciate if you make some short video on these topics as well)
5)When do we use Arrow functions? Arrow functions make our code more concise, and simplify function scoping and the this keyword. By using arrow functions, we avoid having to type the function keyword, return keyword (it’s implicit in arrow functions), and curly brackets. This keyword in arrow functions A normal function has its this keyword ie the scope of this keyword in normal function is its function. whereas in arrow fnction, fat arrow does not have its this, fat arrow takes this from its parent function Which takes us to a conclusion that you should use fat arrow/arrow function when you want to use this of parent function, in case you want to use this of current block/function you should use normal function. for eg take this eg. //profile is an object const profile = { firstName: '', lastName: '', setName: function(name){ let splitName = function(n){ let nameArray = n.split(' '); this.firstName = nameArray[0]; this.lastName = nameArray[1]; } splitName(name) } } profile.setNmae("vikram sharma); console.log(profile.firstName) this code will not give us any output as "this" keyword in normal function will look for its value in the same function only(which is this) setName: function(name){ let splitName = function(n){ let nameArray = n.split(' '); this.firstName = nameArray[0]; this.lastName = nameArray[1]; } , whereas if we use arrow function const profile = { firstName: '', lastName: '', setName: (name) => { let splitName = (n) => { let nameArray = n.split(' '); this.firstName = nameArray[0]; this.lastName = nameArray[1]; } splitName(name) } } profile.setNmae("vikram sharma); console.log(profile.firstName) This will give the output as vikram, becasue fat arrow automatically sets this keyword to setName ie its parent. 6) What is prototype inheritance? Every object has a property called prototype, by which you can add methods and properties to it and when you create other objects from these objects, the newly created object will automatically inherit the properties of the parent, not by including in its own properties but instead it uses from its parent. The way it works is, when you call a particular object or a method it first looks at its own properties if its there and if its not there it will look in its parents properties, therfore this way objects are much lighter. eg: let car = (model) => {this.model = model} car.prototype.getModel = () => return this.model let toyota = car("toyota") console.log(toyota.getModel()) ie we inherited model property from our method car in another method getModel by protyping car 7) what is the difference between function declaration & function expression? console.log(funcD()) ---> function declaration //ie its available to us even before its declaration console.log(funcE()) ---> error // its saved to a var and will behave like one, moreover it has a variable scope function funcD() { console.log("function declaration") } let funcE = function() { console.log("function expression") } 8) what is promises and why do we use it? We use promises to simplify a callback hell
9) What is setTimeout()?
10) what are closures? When a func returns another func, the returning function will hold its environment "Closures are functions that refer to independent (free) variables. In other words, the function defined in the closure 'remembers' the environment in which it was created
let obj = function(){ let i=0; return { setI(k) { i=k; } getI() {return i} }}
8 out 10 questions were asked in my interview, after listening to your tutorial , i am pretty confident about everything .thank you so much gurujiii, all the best!! great going !!!
Thanks, almost all above questions were asked in my interview and I had no clue about a few of them and I was rejected, your tutorials are too good for the beginners. keep motivating us... thanks a ton.
what is prototypal inheritance? 0:27 what is the difference between function declaration and function expression? 2:57 what is promises and why do we use it? 4:22 setTimeout() 6:42 what is closure and how do use it? 8:22
Also would like to add that Promise actually gets queued up in the microtask queue while setTimeout gets queued up in the callback queue. The prioritization of the event loop is that microtask queue -> callback. Therefore if you try to do a setTimeout before a promise ,let say to fetch some API , a promise will actually get returned first.
Just wanted to comment that you CAN pass a declared function in as a variable. You give the function a name in the declaration. So in his example, you'd be able to pass funcD into funcE (if funcE accepts arguments), so something like...funcE(funcD) would console log out both strings (again...if funcE calls the argument passed in)
omg, last week I literally got asked all these questions except for the prototypal inheritance and the function declaration vs expression thing. I hate to say that at that time I didn't find your video so I wasn't able to answer what a closure was. And they also gave me a tricky settimeout exercise. Anyways, they asked for a second interview and here I go again! Thanks a lot for the info!
Great videos (both of them), thank you. Having said that, I could spot one mistake. At 4:00 its stated that to pass a function as an argument to another function we would have to use a function expression. This is not true, we can pass a function declaration as well. Also, it is worth mentioning that function declarations are hoisted whilst function expressions are not.
I watched this tutorial after having watched your other tutorials on Closure, Promise, Call-Apply-Bind, and I have to tell you all three questions puzzled me in my latest interview - so thank you again for sharing these nuggets and helping us better understand problems that puzzled us in the first place!
My first JS interview was fun, ya I didn't do well. But when I was asked those questions, I felt that I knew the answers but not able to answer them. The questions include closures, inheritance and ES... That was fun. And now I am getting into JS stuff ... And these videos are helping me. Thanks :)
I feel you . I know most of the time you know the answer however when interviewer asks our mind just freezes and then it freezes more :) Good luck with your interview. Just relax and take your time .
Thank you for your help. I wish I would have seen this before my last interview. I like how clear and concise you are with your explanations but I wish that your microphone was a little bit louder.
I am a big fan of urs, You explain things in very efficient way, One question "How does JS manage multiple events in parallel, like click, input, etc. when it is interpreted & single threaded?"
JavaScript is more optimal in that sense. it is single threaded and the way it works is very simple. anything that is synchronous will get on the stack and gets executed one by one. However anything asynchronous gets on a queue where it waits for its turn. and when its ready to be executed it waits for the stack to be empty . I have a tutorial on settimeout where i explain it more clearly. ALso look at tutorial for webworkers. which allows you to simulate multithreading with some restrictions.
Hey Buddy, This is the best javascript channel i have seen who covers the topic which are hands on daily javascript programming and The content of this channel is very helpful for beginners as well as mid senior JS developer who is appearning in JS interviews. I want to say you something that why you dont try some aws and node js advance practices that will be very helpful for the subscribers to understand modern trends. Thanks For all your help!
Few of the Questions asked in my Interviews so far. 1. [x,y,z] = "abc"; Console.log([x,y,z]) 2. Why does Javascript have both null and undefined? What was the need to retain undefined? 3. for(var i =0; i
I wasn't able to answer most of these. Few Questions mentioned in your video were also asked in the Interview. Your videos has helped me understand JS better. Thank You.
@techsith, 4:10, I think you can pass function declaration as an argument, should work. Not sure if I understood you properly, because the following code works, function count(val){ console.log(val); } var t = function(func){ func(5); } t(count); // prints `5` In JavaScript, functions are high order objects.
As soon as you pass function desecration to another function it becomes function expression becase it hold inside a variable inside the function. so its no longer function declaration.
@@Techsithtube yes, as a variable in the function agruments per se. I think it would be worth mentioning that, else people might think it is not possible, or it would throw an error if we pass a reference to a function declaration as an argument. :)
Thank you..missed call Bind and Apply in this video..frequently asked and we struggle to answer that..anyhow i checked it in advanced javascript tutorials
Great questions! I’d like to suggest switching to a dark theme for your IDE. Watching this on a large display, your editor is just a wall of white light and difficult to read. Thanks for your videos!
Thanks for the video. The example you used for prototypal inheritance was actually the function definition using prototypes. There is no child parent relation anywhere. Correct me if I am wrong.
Its called function constructors. Base class and subClass relationship is established using prototype chain. I actually have series on Object Oriented JavaScript where I explain this in more detail. Please check it out.
yes because when you pass function declaration as an argument it converts to a "named function expression" . I would work fine in this case but there can be scoping issues like following would also work but it shouldn't function runAndLog(f) { console.log(f()); } runAndLog(one); function one() { return 1; }
This is a hidden treasure I have found. Very informative and nicely put. you are a gem of a person and I really liked the way you have explained the topics with ease.. kudos and keep up the good work and I’ll look forward to more videos from you.
I have an interview tomorrow and mostly about javascript. I have a feeling that I will fail it but many thanks that I found and watched your video. Very helpful!!
Hi there I am wondering if we can compare the concept of "promises" in javascript to be similar to "delegates" in C#? Are they the same thing? In C#, Delegates are function pointers which are useful for callbacks and checking the current status of another running function while within one. They allow you to pass methods as objects. I am wondering if the two concepts are similar. Surprisingly I never knew about either of these before these last few months, so I have been trying to use delegates in C# but mostly in toy problems so far. I am struggling to understand practical usage for these despite watching and reading many things.
No. Delegates in C# are roughly treated as function pointers. Promise api is very different kind of pattern to do async programming and to provide an easier interface for method chaining. Am I clear? Delegates on the other hand
In last example you returned an obj with 2 functions (setI and getI) that didn't had the function keyword ih their declaration. I honestly thought that wouldn't work! Thanks for the tutorial.
What do you think the future holds for Angular? I have tried both Angular and React and Angular comes more natural for whatever reason. With this whole patent thing, could we see more people turn to Angular? I know that Vue is the newest and hottest framework right now but still....
I have have used both as well and Angular also feels natural to me. There are companies who would go for it because its a complete solution . So I think it will continue to do good event with all these other frameworks around it.
What are your thoughts on this problem solving process: 1: restate the problem 2: work through an example and test for edge cases 3: think about the implementation (Pseudocode) 4: write the code 5: test the code with correct input and edge cases 6: relax at bar after interview if you think you tanked it.. ;0)
I would add one more may be around 3, If there are multiple solution than. explain the easiest solution first and say "there might be muliple solutions to this. let me think about it. " and then improve the your work by optimizing it. That would show your ability to improve. BTW, I like the last one. :)
v helpful... can i request you to pls do a video on generators that is tied in to a practical use case... a lot of the tutorials on generators seldom go beyond explaining the syntax... thanks again for producing JS content
Generators will be replaced with async/await in ES7 which has much easier syntax. I recommend to look into it. It will replace the current promise pattern too (.then .catch).
Great sir, Why not you start your udemy course till now? And I am the beginner I have started watching your videos 2 days ago. These are unique and strong our fundamental concepts.
You can pass a function declaration as an argument to another function though. function innerF() { console.log('I ran!'); } function outerF(inner) { let a = inner(); } outerF(innerF); // 'I ran!'
I did not know that. Thank you. So by putting parentheses around the function you did, say like you do with an IIFE, I understand that this is a function expression, but what I don't understand is how calling a function created as a function declaration inside another function makes the inner function a function expression. For example, if I define a function declaration and then pass it in as a callback in an event listener, it doesn't become a function expression, does it? ex: function myFunc() { // do things } el.addEventListener(event, myFunc);
Yes, Any time you pass a function declaration as an argument to another function , either named or anonymous function. the become function expressions.
at the 4:00 examples difference between function declaration & function expression ; IF you used a VAR instead or a LET for funcE, instead of throwing an error wouldn't it show as a undefined for funcE just like it did for funD?
No, it would be the same. That 'undefined' was a 'return value' from the console.log And funcE variable would still be unassigned, so it will give error that undefined is not a function (I think so)
4:10 I'm not sure why you said in the video we can't pass function declaration into another function? If we declare a function we can pass it as an argument to another function.
Honestly I would not use them at all. They are old memes that take any seriousness of content away. I would just find a logo. You already got a brand with the color and font used. javaScript call apply and bind for example looks so nice compared to ones with rage memes But if they work for you then ignore my opinion. It is just another opinion on the internet. Wish you the best :)
Nice Thank you. Could you explain why the following code is returning undefined.As per "hoisting in javascript" it should return 1 right? console.log(a); var a = 1;
Hoisting just hoist the definition of the variable not the value. when you define a variable but not assign any value to it. it is undefined. that is why it gives you that.
may i have your permission to write all of those questions and answers and share on github in my repository? so i can remember // it will be public i guess.. so this is why i ask .
You cannot pass a function declaration to another function, you have to use a function expression.Sir, can you give one example function foo(x) { console.log(x); } var bar = function(func) { func("Hello World!"); } bar(foo); function foo(x) { console.log(x); } var bar = function() { foo('hello world') } bar(); sir its work.
0:33 - what is prototypal inheritance
2:58 - what is the difference between function declaration & function expression
4:21 - what is promises and why do we use it
6:43 - setTimeout()
8:23 - what is closure and how do we use it
Nice tutorial before appearing for JS interview. I had gone through a few interviews and was asked most of these questions and also them:
1. Spread Operator
2. Bind, Call, Apply in JS
3. Array Questions (deep copy and shallow copy of array using assign;also map property used many a times)
4. Ques based on Object Keys
Hope it helps!
(I would appreciate if you make some short video on these topics as well)
5)When do we use Arrow functions?
Arrow functions make our code more concise, and simplify function scoping and the this keyword.
By using arrow functions, we avoid having to type the function keyword, return keyword (it’s implicit in arrow functions), and curly brackets.
This keyword in arrow functions
A normal function has its this keyword ie the scope of this keyword in normal function is its function.
whereas in arrow fnction, fat arrow does not have its this, fat arrow takes this from its parent function
Which takes us to a conclusion that you should use fat arrow/arrow function when you want to use this of parent function, in case you want to use this of current block/function you should use normal function. for eg take this eg.
//profile is an object
const profile = {
firstName: '',
lastName: '',
setName: function(name){
let splitName = function(n){
let nameArray = n.split(' ');
this.firstName = nameArray[0];
this.lastName = nameArray[1];
}
splitName(name)
}
}
profile.setNmae("vikram sharma);
console.log(profile.firstName)
this code will not give us any output as "this" keyword in normal function will look for its value in the same function only(which is this)
setName: function(name){
let splitName = function(n){
let nameArray = n.split(' ');
this.firstName = nameArray[0];
this.lastName = nameArray[1];
}
, whereas if we use arrow function
const profile = {
firstName: '',
lastName: '',
setName: (name) => {
let splitName = (n) => {
let nameArray = n.split(' ');
this.firstName = nameArray[0];
this.lastName = nameArray[1];
}
splitName(name)
}
}
profile.setNmae("vikram sharma);
console.log(profile.firstName)
This will give the output as vikram, becasue fat arrow automatically sets this keyword to setName ie its parent.
6) What is prototype inheritance?
Every object has a property called prototype, by which you can add methods and properties to it and when you create other objects from these objects, the newly created object will automatically inherit the properties of the parent, not by including in its own properties but instead it uses from its parent.
The way it works is, when you call a particular object or a method it first looks at its own properties if its there and if its not there it will look in its parents properties, therfore this way objects are much lighter.
eg:
let car = (model) => {this.model = model}
car.prototype.getModel = () => return this.model
let toyota = car("toyota")
console.log(toyota.getModel())
ie we inherited model property from our method car in another method getModel by protyping car
7) what is the difference between function declaration & function expression?
console.log(funcD()) ---> function declaration //ie its available to us even before its declaration
console.log(funcE()) ---> error // its saved to a var and will behave like one, moreover it has a variable scope
function funcD()
{
console.log("function declaration")
}
let funcE = function()
{
console.log("function expression")
}
8) what is promises and why do we use it?
We use promises to simplify a callback hell
9) What is setTimeout()?
10) what are closures?
When a func returns another func, the returning function will hold its environment
"Closures are functions that refer to independent (free) variables. In other words, the function defined in the closure 'remembers' the environment in which it was created
let obj = function(){
let i=0;
return {
setI(k)
{
i=k;
}
getI()
{return i}
}}
thank you!
I feel like he's feeding my brain fresh organic vegetables. You know what I'm talkin about.
No
😂
8 out 10 questions were asked in my interview, after listening to your tutorial , i am pretty confident about everything .thank you so much gurujiii, all the best!! great going !!!
Thanks, almost all above questions were asked in my interview and I had no clue about a few of them and I was rejected, your tutorials are too good for the beginners. keep motivating us... thanks a ton.
Keep on learning Mohd. Learn fundamentals and everything else will fall in place.
you are the best vanilla javascript teacher ive seen them all from paid ones to free ones you are the best one if not the top 3
Thanks for watching :)
what is prototypal inheritance? 0:27
what is the difference between function declaration and function expression? 2:57
what is promises and why do we use it? 4:22
setTimeout() 6:42
what is closure and how do use it? 8:22
Also would like to add that Promise actually gets queued up in the microtask queue while setTimeout gets queued up in the callback queue. The prioritization of the event loop is that microtask queue -> callback. Therefore if you try to do a setTimeout before a promise ,let say to fetch some API , a promise will actually get returned first.
Just wanted to comment that you CAN pass a declared function in as a variable. You give the function a name in the declaration. So in his example, you'd be able to pass funcD into funcE (if funcE accepts arguments), so something like...funcE(funcD) would console log out both strings (again...if funcE calls the argument passed in)
omg, last week I literally got asked all these questions except for the prototypal inheritance and the function declaration vs expression thing. I hate to say that at that time I didn't find your video so I wasn't able to answer what a closure was. And they also gave me a tricky settimeout exercise. Anyways, they asked for a second interview and here I go again! Thanks a lot for the info!
Great videos (both of them), thank you. Having said that, I could spot one mistake. At 4:00 its stated that to pass a function as an argument to another function we would have to use a function expression. This is not true, we can pass a function declaration as well.
Also, it is worth mentioning that function declarations are hoisted whilst function expressions are not.
Hoisting is already mentioned
I watched this tutorial after having watched your other tutorials on Closure, Promise, Call-Apply-Bind, and I have to tell you all three questions puzzled me in my latest interview - so thank you again for sharing these nuggets and helping us better understand problems that puzzled us in the first place!
I've got an interview next week and these videos are solid interview prep gold. Thank you :)
I am learning more with your videos...
I gave up reading so many book to learn simple things. Thanks
These days books are not very useful as there are better examples available online. Keep up the good work !
My first JS interview was fun, ya I didn't do well. But when I was asked those questions, I felt that I knew the answers but not able to answer them. The questions include closures, inheritance and ES... That was fun. And now I am getting into JS stuff ... And these videos are helping me. Thanks :)
I feel you . I know most of the time you know the answer however when interviewer asks our mind just freezes and then it freezes more :) Good luck with your interview. Just relax and take your time .
I found these tutorials to be VERY helpful and great interview prep.
Thanks for watching! :)
Thank you for your help. I wish I would have seen this before my last interview. I like how clear and concise you are with your explanations but I wish that your microphone was a little bit louder.
I am a big fan of urs, You explain things in very efficient way, One question "How does JS manage multiple events in parallel, like click, input, etc. when it is interpreted & single threaded?"
JavaScript is more optimal in that sense. it is single threaded and the way it works is very simple. anything that is synchronous will get on the stack and gets executed one by one. However anything asynchronous gets on a queue where it waits for its turn. and when its ready to be executed it waits for the stack to be empty . I have a tutorial on settimeout where i explain it more clearly. ALso look at tutorial for webworkers. which allows you to simulate multithreading with some restrictions.
Hey Buddy, This is the best javascript channel i have seen who covers the topic which are hands on daily javascript programming and The content of this channel is very helpful for beginners as well as mid senior JS developer who is appearning in JS interviews.
I want to say you something that why you dont try some aws and node js advance practices that will be very helpful for the subscribers to understand modern trends.
Thanks For all your help!
Few of the Questions asked in my Interviews so far.
1. [x,y,z] = "abc"; Console.log([x,y,z])
2. Why does Javascript have both null and undefined? What was the need to retain undefined?
3. for(var i =0; i
These are some good questions. Were you able to answer them?
I wasn't able to answer most of these. Few Questions mentioned in your video were also asked in the Interview. Your videos has helped me understand JS better. Thank You.
watched the whole series && learned a lot. thanks!
Awesome video! This is probably the 10th-odd video I've seen of yours and they've always been very clear and easily to follow. Keep up the great work!
Thanks Adam. I am glad you like it. :)
I think you have the knack for imparting knowledge - I love it! Cheers.
I wasn’t aware that Closure was an actual property that can be accessed. Thank you for showing me this!
@techsith, 4:10, I think you can pass function declaration as an argument, should work. Not sure if I understood you properly, because the following code works,
function count(val){
console.log(val);
}
var t = function(func){
func(5);
}
t(count); // prints `5`
In JavaScript, functions are high order objects.
As soon as you pass function desecration to another function it becomes function expression becase it hold inside a variable inside the function. so its no longer function declaration.
@@Techsithtube yes, as a variable in the function agruments per se. I think it would be worth mentioning that, else people might think it is not possible, or it would throw an error if we pass a reference to a function declaration as an argument. :)
Aweosme...just love your videos...they are very helpful...
Thanks for sharing this video... From these 10 questions, i got 8 questions in my interviews. Please share more questions from javascript and angular.
Here is a playlist with more interview questions. ruclips.net/p/PL7pEw9n3GkoWn5TcqAdmSzXcvC3d_tfAh
Thanks for posting this video and It's clear and depth ...please provide more videos of Js and Angular
Thank you..missed call Bind and Apply in this video..frequently asked and we struggle to answer that..anyhow i checked it in advanced javascript tutorials
Yes that is true. I have been asked that many times. Thanks for pointing out.
Well... he has tutorials on them and also has a video discussing their implementations... So, go check it out
Great questions! I’d like to suggest switching to a dark theme for your IDE. Watching this on a large display, your editor is just a wall of white light and difficult to read. Thanks for your videos!
I have already switched for newer videos. Thanks for watching!
Thanks for your video! It's very useful. Could you please enable your subtitles caption just as other videos you did before? Thank you so much!
Thanks for this video. Yes, closure is a very important topic of Javascript. I have faced it two times.
Hast's off man, you doing really well job.
Also add because I have faced multiple time this quest. "Event Bubbling" & "Event Delegation".
I have tutorial on Event Bubbling also if you want to check it out. Good luck with your interviews.
Yeah got it, nice one (y) (y)
Thanks for the video. The example you used for prototypal inheritance was actually the function definition using prototypes. There is no child parent relation anywhere. Correct me if I am wrong.
Its called function constructors. Base class and subClass relationship is established using prototype chain. I actually have series on Object Oriented JavaScript where I explain this in more detail. Please check it out.
for a junior dev interview i have been asked what are media queries and how to you code them, == vs ===, and var vs. let vs. const :)
Yes there are very common questions. Everyone should prepare for that. :)
Not sure if this is what he meant at @4:01 but it works fine:
function one() { return 1; }
function runAndLog(f) { console.log(f()); }
runAndLog(one);
yes because when you pass function declaration as an argument it converts to a "named function expression" . I would work fine in this case but there can be scoping issues like following would also work but it shouldn't
function runAndLog(f) {
console.log(f());
}
runAndLog(one);
function one() {
return 1;
}
11:31 life lessons learned from admiral Ackbar.
This is a hidden treasure I have found. Very informative and nicely put. you are a gem of a person and I really liked the way you have explained the topics with ease.. kudos and keep up the good work and I’ll look forward to more videos from you.
I have an interview tomorrow and mostly about javascript. I have a feeling that I will fail it but many thanks that I found and watched your video. Very helpful!!
how many questions ask from this 2 videos??
I have also tomorrow an interview and I have not much knowledge about javascript is these 2 videos of interview preparation enough ??
@@shevangpatel3537 Good luck to you! My interview question is about React though...
@@cloriswang2576 my interview is about angular still I have a time please advice me which sourse i prefer to crack the interview
Thanks, man, you showed the best example for closures understanding, nice job!
Would like to see video on design patterns in JavaScript.
And what to know React is based on which design pattern.
my first js interview went terrible as i didn't watched this video but will go for more as it gave me some nice experience
It is very helpful, I was asked some of the questions already. Thanks!
Awesome video and explanation (part 1 as well). It really helps me with the interviews! Thank you very much!
Thank you ,this series is great ,please keep building
Really clear explanation, Really it helps me to clear my concept
I am glad it helped. Thanks for watching ! :)
I really like this guy's videos, seems very real life experience and good examples to illustrate the topic.
Hats off to your patience. What a great and simple way to explain things. Thanks sir.
:) Thanks for watching!
Around 04:10 I'm 99% sure I understand what you're getting at but an example would be really helpful to solidify the explanation
Hi there I am wondering if we can compare the concept of "promises" in javascript to be similar to "delegates" in C#? Are they the same thing? In C#, Delegates are function pointers which are useful for callbacks and checking the current status of another running function while within one. They allow you to pass methods as objects. I am wondering if the two concepts are similar.
Surprisingly I never knew about either of these before these last few months, so I have been trying to use delegates in C# but mostly in toy problems so far. I am struggling to understand practical usage for these despite watching and reading many things.
I have not used delegates in c# so I cant comment on that.
No. Delegates in C# are roughly treated as function pointers. Promise api is very different kind of pattern to do async programming and to provide an easier interface for method chaining.
Am I clear?
Delegates on the other hand
In last example you returned an obj with 2 functions (setI and getI) that didn't had the function keyword ih their declaration. I honestly thought that wouldn't work! Thanks for the tutorial.
stackoverflow.com/questions/32404617/how-does-this-object-method-definition-work-without-the-function-keyword for those to which this is new.
Thanks for the nice tutorial, but I wish the answers were displayed on a slideshow so we could take notes easily.
What do you think the future holds for Angular? I have tried both Angular and React and Angular comes more natural for whatever reason. With this whole patent thing, could we see more people turn to Angular? I know that Vue is the newest and hottest framework right now but still....
I have have used both as well and Angular also feels natural to me. There are companies who would go for it because its a complete solution . So I think it will continue to do good event with all these other frameworks around it.
What are your thoughts on this problem solving process:
1: restate the problem
2: work through an example and test for edge cases
3: think about the implementation (Pseudocode)
4: write the code
5: test the code with correct input and edge cases
6: relax at bar after interview if you think you tanked it.. ;0)
I would add one more may be around 3, If there are multiple solution than. explain the easiest solution first and say "there might be muliple solutions to this. let me think about it. " and then improve the your work by optimizing it. That would show your ability to improve.
BTW, I like the last one. :)
Great explaination!!
Simple & crisp.. :)
Keep going..
excellent explanation on prototypical inheritance! thanks
you are a god techsith... thank you
:) Hanna, thanks for an awesome comment.
It is very useful and please provide oops concepts of javascript sir thankyou for helping us in this way
Thanks a lot for feeding us with the Javascript knowledge and preparing for interviews.
It's my pleasure
Awesome tutorial. Thanks
Glad it was helpful!
I subscribed, your way of explaining is very good and relaxing
Thank you Ismail for subscribing!
Just one note: It is considered good practice to name constructor functions with an upper-case first letter.
I think you should make a video explaining about Promises in detail.
I do have a video specifically on promises. Do check it out.
v helpful... can i request you to pls do a video on generators that is tied in to a practical use case... a lot of the tutorials on generators seldom go beyond explaining the syntax... thanks again for producing JS content
Generators will be replaced with async/await in ES7 which has much easier syntax. I recommend to look into it. It will replace the current promise pattern too (.then .catch).
Thanks for posting this video it is very helpful for beginners....:-)
Thanks for watching!
The channels name is On Point
best explanation for closure
By convention, constructor functions meant to be used with new are named with starting Capitals. So I believe it's better to name car at 2:05 as Car
That is true.
Very useful. Thanks
Great sir, Why not you start your udemy course till now? And I am the beginner I have started watching your videos 2 days ago. These are unique and strong our fundamental concepts.
I am actually working on a udemy course. Might release it by end of the august.
Sir Great video but please improve the Audio Quality.
Function Declaration type of function can be passed around with proper scopes. I tried this with window scope for now
thanks for this. Really threw me that getter & setter methods don't need 'function' keyword in ES6. might be worth mentioning that.
yes that is true. I am going to create a third part of this series where I will mention that. Thanks for pointing it out.
Ledies and gentlemens. he is a good teacher. Yesssss??!
Great job
You can pass a function declaration as an argument to another function though.
function innerF() {
console.log('I ran!');
}
function outerF(inner) {
let a = inner();
}
outerF(innerF);
// 'I ran!'
as soon as you put parentheses around the function declaration it becomes function expression :)
( function innerF() {
console.log('I ran!');
})
I did not know that. Thank you. So by putting parentheses around the function you did, say like you do with an IIFE, I understand that this is a function expression, but what I don't understand is how calling a function created as a function declaration inside another function makes the inner function a function expression. For example, if I define a function declaration and then pass it in as a callback in an event listener, it doesn't become a function expression, does it?
ex:
function myFunc() { // do things }
el.addEventListener(event, myFunc);
Actually looking at this I see what you mean now.
Yes, Any time you pass a function declaration as an argument to another function , either named or anonymous function. the become function expressions.
hi! thanks for the lesson & it would be better that u keep your voice in same rhythm, voice going up & down which is hard to hear
Titus, this is a old video when i didnt have good audio device, newer videos have better audio.
Great work sir 👏👏👍
Has the best interview advice from the back of the video.
Thanks a lot, very clear explanations. Could you please make videos on common JS coding challenges given at interviews?
Very good video. One can get a positive attitude with it. Great job my friend.
Thank you satyen , I just released a new video on more interview questions do check it out.
If we use var instead of let in function expression, hoisting will take place and will show no error.
at the 4:00 examples difference between function declaration & function expression ; IF you used a VAR instead or a LET for funcE,
instead of throwing an error wouldn't it show as a undefined for funcE just like it did for funD?
No, it would be the same. That 'undefined' was a 'return value' from the console.log
And funcE variable would still be unassigned, so it will give error that undefined is not a function (I think so)
i am big fan of u and thanks for vedeo, please post videos like this. Gain knowledge and confidence at same time. subscribed:)
You are great sir...
Phenominal! Thank you!!
You're so amazing, so clear
4:10 I'm not sure why you said in the video we can't pass function declaration into another function? If we declare a function we can pass it as an argument to another function.
This channel is very helpful. I did not expect it to be this good given that bad meme use for thumbnails.
With memes I try to create a theme. Let me know your opinion on what kind of meme you feel are good so I can improve.
Honestly I would not use them at all. They are old memes that take any seriousness of content away. I would just find a logo. You already got a brand with the color and font used. javaScript call apply and bind for example looks so nice compared to ones with rage memes
But if they work for you then ignore my opinion. It is just another opinion on the internet. Wish you the best :)
Sorry if that came out the wrong way btw. We all forget there is someone on the other side of the screen. Loved the content so keep it up!
Nice Thank you.
Could you explain why the following code is returning undefined.As per "hoisting in javascript" it should return 1 right?
console.log(a);
var a = 1;
Hoisting just hoist the definition of the variable not the value. when you define a variable but not assign any value to it. it is undefined. that is why it gives you that.
@@Techsithtube understood thanks
To 4:00 here is example of using function declarations and function statement as a callback to funcktions :
jsbin.com/cohozaciwa/edit?js,output
Patryk Janik exactly my question too. It would be helpful if this was answered.
Function declaration and expression can pass to another method
Prototype example Let keyword is used, but its scope is witin block, so y it was used outside block (let car),
Thanks for the tutorial. Can you please provide a tutorial on using Chrome Dev Tools for profiling Js ?
i got the closure and the promise questions only !.. and it was too hard for me. the others i know . thank you so much. i need to practice es6
Yes ES6 is very important these days.
may i have your permission to write all of those questions and answers and share on github in my repository? so i can remember // it will be public i guess.. so this is why i ask .
Yes feel free to share publicly. Knowledge is there for sharing
Thanks so much for sharing your knowledge....Awesome !!!
Thanks for the video! Very enlightening!
You cannot pass a function declaration to another function, you have to use a function expression.Sir, can you give one example
function foo(x) {
console.log(x);
}
var bar = function(func) {
func("Hello World!");
}
bar(foo);
function foo(x) {
console.log(x);
}
var bar = function() {
foo('hello world')
}
bar();
sir its work.
Love your videos techsith I just subscribed, keep this series going!!
please also provide us with data structures/algorithm questions as well.
I also have another channel focused on the algorithm and data structure, it's called interviewnest please check it out.