@Akshay before this video I went through lot of blogs like medium, stackoverflow to understand binds internal implementation, this is the most easiest and awesome explanation I have ever seen for BIND.Thank you so much :) Can you also make a video on implementing own promise and implementing own virtual DOM ?
I do have knowledge on Javascript concepts but whenever I want to prepare for interviews or want to refresh my understanding about those concepts ,your youtube channel is the first thing which comes to my mind. I cant stop thanking you for sharing your knowledge in such a detailed way.
Dude you are amazing! I am a senior engineer and I know all these concepts I still come back to your videos to refresh my knowledge before interviews! Keep up the great work.
i saw your video on bind, then i saw this one, paused it, tried to do this on my own, got sucess, i haven't used call or apply or any es6 ( like "..." notation )as you said its for older browsers, so yeah i did it, really happy with my result.
Prototype ,proptotypal inheritence ,prototype chaining ,call bind apply all i have learnt from you now everything was implemented here and i understood it with utmost efficacy thanks Akshay
The bind() method creates a new function, when invoked, has the this sets to a provided value. The bind() method allows an object to borrow a method from another object without making a copy of that method. This is known as function borrowing in JavaScript.
Not a even the og youtubers discuss these core topics like you. Thank you! More simpler version of the myBind function: Function.prototype.myBind = function (...args1) { return (...args2) => this.call(...args1, ...args2); }
I never knew what polyfill was. It appeared to me as a advanced concept. But you have explained this topic very well and i think i have got a good grasp of it. THANKS A LOT.
Hi @akshay, u r doing a great job !! i have one small suggestion. in line no 17 i think we can add return before obj.apply(....) also, because if printName will return something then our mybind will return always undefined.
Short solution: Function.prototype.mybind = function (...args) { return (...args2) => this.call(...args, ...args2); }; "this" inside the arrow function refers to the function on which mybind function is called.
well explained... one thing I wanted to add if we add obj.call(...args) only then we don't need to do any other thing like param and apply... please try thanks !!! Function.prototype.mybind = function(...args) { let obj = this; return function (...args2){ obj.call(...args, args2); } } let printName2 = fullName.mybind(name, 'Dehradun') printName2('Uttarakhand');
Ultimate explanation Akshay! Really amazing work of helping so many like me out there. God bless you 🙏🏻 "In the interviews, if we don't want to be SHY, then we gotta learn from AkSHAY" 😎
Hi @Akshay, Thank you so much for making these videos. I saw your videos and cracked too many interviews for Front End Developer. Thank you so much again.
Awesome explanation. One minor thing is missing I believe which is returning the result of the bound function. return obj.apply(args[0], [...params, ...args2]);
Hi Akshay, First of all you explain things really well, in a very simple and crisp manner. Please make a video on async await. This concept has always puzzled me and still not very confident about it. Please its a humble request.
Function.prototype.myBind = function (...args) { let ref = args[0]; let params = args.slice(1); let obj = this; return function (...args2) { args[0].gt = obj; //This is my impelementation of the bind polyfill, I haven't used apply method over here. args[0].gt(...params, ...args2); }; }; //I have checked it works.
Well the video was great 🔥 thanks, but we are again using the apply and call function, can you do a video on how can we achieve it without using call() and apply(), thanks in advance.
I have used here call method in place of apply method. And here is my code : let person={ name :'John', age:30 }; let personDetails=function(city,street){ console.log("Name : "+this.name+" Age : "+this.age+" City : "+city+" Street : "+street); } Function.prototype.mybind=function(...args){ let obj=this, param=args.slice(1).toString(); return function(...args2){ param2=args2.toString(); obj.call(args[0],param,param2) //obj.apply(args[0],[...param,...args2]); } } let result=personDetails.mybind(person,'Norway'); result('11th Street');
Thanks Akshay for explaining it clearly. I think this is the best video I watched on polyfils. I have a small question here, when we are trying to console this inside Function.prototype.myBind it is referring to window and at the same time if we assign it to variable it is referring to binding function printFullName. is this normal behaviour or am I reading it wrong?
Hi akshay, your teaching skills are exceptional! and can you make a video series on css? you have covered core and advanced concept of javascript likewise I need in css with building a web application from scratch
We should also understand this code will not work as a real polyfill because bind fn is a es5 contruct and “...” is a es6 construct. We should use arguments object to access the args.
Nicely explained. Just wondering if interviewer will be okay with a polyfil for bind that uses apply internally. I mean call, bind and apply fall into a common category. Also, a browser that supports ES6 spread operator would also support bind.
Hi, Can you also make a video on implementing own promise and implementing own virtual DOM ? @akshay please make on async and await concepts as well.....waiting for it
@Akshay before this video I went through lot of blogs like medium, stackoverflow to understand binds internal implementation, this is the most easiest and awesome explanation I have ever seen for BIND.Thank you so much :) Can you also make a video on implementing own promise and implementing own virtual DOM ?
medium pe bass gyaan milta hai.. real life scenario nhi milne wale..
akshay bhai k liye meri taraf se 2 likes
@@pioneer7161 bhai 2 likes mat kar ek hi kar 2 karega toh jo ek kiya woh Bhi hat jayega😜😜
I do have knowledge on Javascript concepts but whenever I want to prepare for interviews or want to refresh my understanding about those concepts ,your youtube channel is the first thing which comes to my mind. I cant stop thanking you for sharing your knowledge in such a detailed way.
Dude you are amazing! I am a senior engineer and I know all these concepts I still come back to your videos to refresh my knowledge before interviews! Keep up the great work.
How does this variable refer printName method inside myBind function? I am confused here.
6:37 nee,
Not only you taught us how to make bind function but also u have taught us how to think...❤️ Loving your videos and hence loving js
i saw your video on bind, then i saw this one, paused it, tried to do this on my own, got sucess, i haven't used call or apply or any es6 ( like "..." notation )as you said its for older browsers, so yeah i did it, really happy with my result.
Hi Pravas, can you please share your code, without es6, call and apply
Would like to see the polyfill without call and apply, how do you pass the 'this' binding inside the returning function?
Prototype ,proptotypal inheritence ,prototype chaining ,call bind apply all i have learnt from you now everything was implemented here and i understood it with utmost efficacy thanks Akshay
Bro.. You are doing social service for us... Thanks for your help.. Keep helping.. keep growing...
I can clearly see closure application in poly filling the bind function. 😅 Thanks for providing this power to see through code, Akshay.
Your explanation about basic concepts is so good. I've been watching the entire JS series! Thank you so much
The bind() method creates a new function, when invoked, has the this sets to a provided value.
The bind() method allows an object to borrow a method from another object without making a copy of that method. This is known as function borrowing in JavaScript.
Not a even the og youtubers discuss these core topics like you.
Thank you!
More simpler version of the myBind function:
Function.prototype.myBind = function (...args1) {
return (...args2) => this.call(...args1, ...args2);
}
I never knew what polyfill was. It appeared to me as a advanced concept. But you have explained this topic very well and i think i have got a good grasp of it. THANKS A LOT.
Hi @akshay, u r doing a great job !!
i have one small suggestion.
in line no 17 i think we can add return before obj.apply(....) also, because if printName will return something then our mybind will return always undefined.
The best teacher I've ever got for how to learn and what to learn in java script... Akshay sir❤
Short solution:
Function.prototype.mybind = function (...args) {
return (...args2) => this.call(...args, ...args2);
};
"this" inside the arrow function refers to the function on which mybind function is called.
helpfull bro TQ
Explained very well. Please make a video on 'this'.
after 5 yrs, ur wishes came true
give this guy a medal...
what a MASTERPIECE :)
one thing we missed in this series. And that is your big smile.
well explained... one thing I wanted to add if we add obj.call(...args) only then we don't need to do any other thing like param and apply... please try thanks !!!
Function.prototype.mybind = function(...args) {
let obj = this;
return function (...args2){
obj.call(...args, args2);
}
}
let printName2 = fullName.mybind(name, 'Dehradun')
printName2('Uttarakhand');
Learned first time and wow it was super easy because of your teaching method. thanks bro
You are Best.. Very Well Explained.
You are simply awesome 👏🏽 The way you clear things and make us understand it very straight is fabulousness. Thanks bro 🙏
well explained 👍
------ updated code -------
Function.prototype.myBind = function(obj, ...arg){
const fn = this;
return function(){
fn.apply(obj, arg);
}
}
you are the God of javascript bro love you
Ultimate explanation Akshay! Really amazing work of helping so many like me out there. God bless you 🙏🏻
"In the interviews, if we don't want to be SHY, then we gotta learn from AkSHAY" 😎
Understanding it step by step- Awesome explaination
Hi @Akshay, Thank you so much for making these videos. I saw your videos and cracked too many interviews for Front End Developer. Thank you so much again.
You are a life saver for us man.......👍
Awesome explanation. One minor thing is missing I believe which is returning the result of the bound function.
return obj.apply(args[0], [...params, ...args2]);
Wow this is one hell of an explanation.
Love from Pakistan 🇵🇰
It was kind of complicated but u nailed it easily 😃
Hi Akshay,
First of all you explain things really well, in a very simple and crisp manner. Please make a video on async await. This concept has always puzzled me and still not very confident about it. Please its a humble request.
Very well explained Sir... your videos are great help for learning
😍😍😍 Finally We wrote own Native code. Brendan Eich i'm coming 😝.
Excellent explanation. Akshay bro u are fav teacher of mine..
explained with simplicity. awesome content.
Function.prototype.myBind = function (...args) {
let ref = args[0];
let params = args.slice(1);
let obj = this;
return function (...args2) {
args[0].gt = obj; //This is my impelementation of the bind polyfill, I haven't used apply method over here.
args[0].gt(...params, ...args2);
};
};
//I have checked it works.
Thanks I understand it completly.
Your this playlist is just fire
Thank You Akshay for this lovely explanation.
Really impressive way of teaching and the topics/questions are superb.
excellent work. great teaching . I love this. Thank you
@Akshay Great explanation. Thank you. You are such a great teacher.😊
Thank you dude, this was an amazing explanation!
Can you please make a video on how to implement the .call( ); method?
I'm glad i found your channel, its gold. keep it up brother.
Hey ! Thanks for explaining its makes the comfort to learn any concept
Thank you @Akshay explaining this complex topic in a such a easy way :)
excellent example and teaching.
Hi Akshay, If we use a Params directly in to the return function then we use obj.call(…args, …params)
Great actually a Best video on UA-cam please make a JavaScript whole series
Great content Akshay. Request you to make a video on arrow function and 'this' keyword in your Namaste JS series.
When its a polyfill for a bind then can we really use apply or call ?
This makes sense. As a interview question, it is okay, but what you said is valid. Which browser supports call apply but not bind.
that was awesome. I am becoming your fan slowly. thank you for this valuable information.
this is super awesome video for bind Polyfill . @akshay can you please create a polyfill video of Promise, call and apply method.
Great Akshay. Awesome..
Your explanation is very nice..
So interviewers had figured it out how to torture Frontend guys with these questions since they don't expect DS and Algo from them. Good
lol
JS is not only about frontend bro.
@@rhimanshu6288 polyfills are for browsers not node environment
Well the video was great 🔥 thanks, but we are again using the apply and call function, can you do a video on how can we achieve it without using call() and apply(), thanks in advance.
Really very good explanation
pura hindi jaisa lagta h..nice
Very nice explanation @Akshay Saini, "Ek number :-)"
Please also start a playlist on Angular or React JS. I believe its going to help a lot of us. Thanks.
Simple and Great Explanation Akshay :)
Brilliant explanation
AWESOME !!!!
Awesome teacher🎉
You motivate me. Your teaching skills are fabulous. I learnt a lot by just viewing a few videos of yours 😊 Keep up the good work
I have used here call method in place of apply method.
And here is my code :
let person={
name :'John',
age:30
};
let personDetails=function(city,street){
console.log("Name : "+this.name+" Age : "+this.age+" City : "+city+" Street : "+street);
}
Function.prototype.mybind=function(...args){
let obj=this,
param=args.slice(1).toString();
return function(...args2){
param2=args2.toString();
obj.call(args[0],param,param2)
//obj.apply(args[0],[...param,...args2]);
}
}
let result=personDetails.mybind(person,'Norway');
result('11th Street');
same for me call is also working for me
Thanks for the explanation 😊
Fun will be when interviewer says apply is also not available write for that too
You have a solution for that?
@@vikramkrish710 yes
@@vikramkrish710 use call with array spread
@@vikramkrish710 Something like this...
Function.prototype.myBind1 = function (...args) {
let obj = this;
let params = args.slice(1);
return function (...args1) {
obj.call(args[0], [...new Set(params)], [...new Set(args1)]);
};
};
@@venkateshdec27 explain ...new Set pls.
O bhayankar, dehradun se. 😂😂 great tutorial
concept explained very clearly. Thanks :) , gotta learn alot from you
Good explaination bro ..... keep it up ! 👌
It was really good! Please post videos on promises!
Thanks for the beautiful explanation...
@everyone :any suggestions on angular 9 learning video please
you got subscriber++. thank you Akshay the video is awesome
Good one akshay, Jhakkas
Thanks Akshay for explaining it clearly. I think this is the best video I watched on polyfils. I have a small question here, when we are trying to console this inside Function.prototype.myBind it is referring to window and at the same time if we assign it to variable it is referring to binding function printFullName. is this normal behaviour or am I reading it wrong?
Simply Awesome.
Hi akshay, your teaching skills are exceptional! and can you make a video series on css? you have covered core and advanced concept of javascript likewise I need in css with building a web application from scratch
Awesome as always
You are like the Yoda of bind method. :-D
Wao
@akshay Saini Thanks for this answer. Could you add video for implementing Two way data binding .
Bro you are so pro.....
We should also understand this code will not work as a real polyfill because bind fn is a es5 contruct and “...” is a es6 construct. We should use arguments object to access the args.
True, I agree 👍
Nicely explained. Just wondering if interviewer will be okay with a polyfil for bind that uses apply internally. I mean call, bind and apply fall into a common category. Also, a browser that supports ES6 spread operator would also support bind.
@Akshay, that was a great explanation, Could you please bring such explanation for Polyfill for promise?
Yup, that's a great ask. Thank you, I'll try to come up with it soon. ❤️
Outstanding bro . Can you please make a video on polyfill for promises
Thanks for the video
Hi, Can you also make a video on implementing own promise and implementing own virtual DOM ? @akshay please make on async and await concepts as well.....waiting for it
Awesome work man! keep it up! really helped me through. :)
Wow 😍
nice great helpful
sir please also make video for call and apply method
Thank you so much for creating this video! This really helped all of us a lot! #AkshayMeraBhai
your explanations are simple and clear. btw, is this black t-shirt your recording uniform?
instead of use apply method and other lengthy code can simple optimize the code by using return function(){
obj.call(...args)
}
Thanks sir❣️❣️❣️
Great video man !!