Call, apply & Bind in JavaScript - Front End Interview 🔥 Episode 4 - In 20 Minutes
Вставка
- Опубліковано 22 лис 2021
- Learn call, bind & apply functions in JS - step by step with examples.
This is a common JavaScript interview question. Learn why we use the call function and what is need of the call function. If you want to set the value of this keyword while calling the function, you need to use the call or apply method. bind is similar to call or apply but the function is not executed immediately but returns another function instance that is bound to the object you have passed in the bind call.
⭐ Timestamps to Skip the video:
00:00 - Don't skip anything 🙏
I believe that this video will help you to understand better in terms of career growth.
Put your comments and share your experience with us if you like this video. Also if you have some suggestions then please suggest them in the comment box.
⭐ Modern JavaScript ES6 Tutorial by Technical Suneja
► bit.ly/3CkjENa
⭐ Full Stack Web Developer ( Complete Roadmap)
► ytube.io/3JYi
⭐ Support vs Development Jobs? Projects? What to choose
►ytube.io/3K5i
⭐ Off-Campus Job Placements Complete Roadmap ► ytube.io/3JpA
⭐ Latest IT Vlogs :
► ytube.io/3Ik9
⭐ Wednesday Episodes By Technical Suneja
► ytube.io/3FIN
⭐ Coding Stuff :
► / technicalsunejaji
⭐ ReactJS Tutorial For Beginners. :
► ytube.io/3FIL
⭐ CTC v/s IN HAND SALARY | Huge Packages Explained🤔 GOOGLE, MICROSOFT, Facebook! 🔥
► ytube.io/3FIF
⭐ Top 5 Programming languages for 2021
► ytube.io/3FIH
⭐ Best Top 5 Frontend Frameworks of 2021 for Web Development
► ytube.io/3FII
⭐ 10 Generic steps to becoming Javascript Developer | Frontend & Backend Both🔥
► ytube.io/3FIJ
⭐ Best LinkedIn Tips for Job seekers in 2021 - Proper Utilisation of LinkedIn 🔥
► ytube.io/3FIK
⭐ My Thoughts on Web Development & Mobile App Development - Which is better?
► ytube.io/3FIS
⭐ Competitive Programming vs Software Development - Where Should I Invest My Time? 🔥
► ytube.io/3FIR
⭐ My Thoughts on Mean Stack Developer - Are you looking for a FullStack Developer?🔥
► ytube.io/3FIQ
⭐ My Thoughts on Full Stack Developer - Perfect Path 🔥🔥
► ytube.io/3FIP
Want Webhosting service ?
If you are planning to host your website in a very decent amount you can contact us on the given numbers.
Contact Details :
1. +91-9990131528
2. +91-8529119425
More Details (Visit our website ) ►hosting.technicalsuneja.com/
⭐ Follow us on Social Media platforms:-
------------------------------------------------------------
🔥 Instagram ► / sunejaajay
🔥 Technical Suneja Official Instagram ► / asksunejaji
🔥 Facebook Page ► / technicalsunejaji
🔥 Join Group ► / 1981858225403035
🔥 LinkedIn ► / ajaysuneja
------------------------------------------------------------
⭐ My Telegram Group Link:
Technical Suneja official ► t.me/joinchat/V53dTczAWc52IrLv
⭐ My UA-cam equipment
1)MacBook Air ► amzn.to/2Tqj3Zz
2)LCD Screen for Coding ► amzn.to/3zeYSyi
3)SanDisk 500GB SSD ► amzn.to/3pNEArf
4)WD 1TB Normal ► amzn.to/3gr5UY9
5)HP laptop ► amzn.to/3pK4NHg
6)Canon M50 Mark II ► amzn.to/2TjlEEO
7)Chair Link ► amzn.to/2RSvoWk
8)Echo Dot (3rd Gen) ► amzn.to/3iCLhLd
9)Canon EF-S 18-55mm lens ► amzn.to/3cEwH22
10)HP Laserjet ► amzn.to/3zjEEn7
11)JBL Headphones ► amzn.to/3gwXEGf
⭐ Microphone:
1)Boya Lav Mic ► amzn.to/2SsqVtD
2)BOYA by-MM1 ► amzn.to/3gdZKf4
4)Uhuru UM-SF777 ► amzn.to/3go4mOG
1)GoPro Max ► amzn.to/3gtdf9F
2)GoPro Accessories ► amzn.to/3xlCIc5
⭐ Lights Used:
1)Digitek (DRL-18HC9) Professional ► amzn.to/3gj9yVo
2)GoDox SL60W ► amzn.to/3whw9Hr
My Router ► amzn.to/3ge4RMr
Realme Buds Air ► amzn.to/3gtzpIX
⭐ Tripod
1)DIGITEK® DTR ► amzn.to/3ge0AZg
2)For Mobile ► amzn.to/3iBfrPh
3)JB01507-BW ► amzn.to/3pQ48UL
call bind apply in javascript,javascript interview questions,call apply bind javascript tutorial,difference between call,apply and bind javascript,this keyword in javascript in hindi,javascript this keyword in hindi,learn javascript from scratch hindi,javascript for beginners hindi,javascript cheezycode tutorials hindi,learn javascript programming hindi,full stack javascript series,cheezycode javascript web development
#ITVlogs #JavaScript
00:00 - Don't skip anything 🙏
Aur kya haal sabke?
btao next topic JS kon sa hona chahiye ??
bhaiya backend With node Js interview pr video bnao...☺☺
please make a video on throttling and denouncing in details.
How is bind saved in memory stack vs a call? Does bind creates a reference?
function ke uper video honi chahiye ziayda confusion function main hoti simple function aur arrow function main
@@rajasinghrajpoot8626 yes right i also need
The way you explained call,bind and apply....it's fantastic 👏
The way you explained call, apply and bind....it's fantastic. Thanks @Technical Suneja
Very well explained with examples! Thank you!
You seems to be very humble person... thanks for the video!
Explained Nicely... Jab hume pata hi nahin hai problem kahan hai... Solution ko kaise use karen... Great sir
thanks bro such a wonderful explanation, i have read articles but i didn't get the concept but your video is enough, beautifully explained.
waw ! amazing , bhut video dekhe ,lekin ab ja kr clear hua , thank u guru ji
thank you so much finally clear my doubts in these 3 methods
Thank you very much sir...
For providing us such wonderful videos... 💯❤️
Your explanation is really very good and understandable.
Very Well Explained. Thank you very much..
Very helpful video thank you sir❤❤
Thanx Bhaiya ❤️, Understood all.
Perfect!!! 🤩.. thank you so much!
its awesome video all douts clear sir thank you
Ye series to amazing h bhaiya 👍
Thankyopu so much best explanation and simple explanantion
Bhai ne smjha diya vo bhi simple word me❤❤
thanks for sharing amazing video
nice video every point discussed in video was clear to me
sir ,i request u to make a playlist on javascript for beginners to advance.
Please learn these concepts because today in my mid-level react interview I got these questions.
In JavaScript, call, apply, and bind are methods that allow you to control the value of the this keyword within a function and also enable you to pass arguments to a function in different ways. These methods are commonly used in object-oriented programming and functional programming paradigms.
Call Method:
The call method is used to call a function and explicitly specify the value of this inside the function. It allows you to pass arguments to the function individually as a comma-separated list.
javascript
Copy code
const person = {
name: "John",
sayHello: function() {
console.log(`Hello, my name is ${this.name}`);
},
};
const anotherPerson = {
name: "Alice",
};
person.sayHello(); // Output: Hello, my name is John
person.sayHello.call(anotherPerson); // Output: Hello, my name is Alice
In the example above, we have an object person with a method sayHello. Using call, we can invoke the sayHello method with a different object anotherPerson to change the value of this inside the method.
Apply Method:
The apply method is similar to the call method, but instead of passing arguments individually, it takes the arguments as an array.
javascript
Copy code
const person = {
name: "John",
sayHello: function(greeting) {
console.log(`${greeting}, my name is ${this.name}`);
},
};
const anotherPerson = {
name: "Alice",
};
person.sayHello("Hi"); // Output: Hi, my name is John
person.sayHello.apply(anotherPerson, ["Hello"]); // Output: Hello, my name is Alice
In this example, we have modified the sayHello method to accept a greeting argument. Using apply, we can pass the arguments in an array to change the value of this inside the method and provide the greeting.
Bind Method:
The bind method is used to create a new function with a specific value for this, which can be used later. Unlike call and apply, the bind method does not immediately invoke the function but returns a new function with the specified this value.
javascript
Copy code
const person = {
name: "John",
sayHello: function() {
console.log(`Hello, my name is ${this.name}`);
},
};
const anotherPerson = {
name: "Alice",
};
const helloFunction = person.sayHello.bind(anotherPerson);
helloFunction(); // Output: Hello, my name is Alice
In this example, we use bind to create a new function helloFunction with the value of this set to anotherPerson. When we call helloFunction(), it logs the message with the name from anotherPerson.
Choosing Between Call, Apply, and Bind:
The choice between call, apply, and bind depends on your specific use case. Use call or apply when you want to immediately invoke a function with a specific this value and pass arguments individually or as an array, respectively. Use bind when you want to create a new function with a preset this value to be called later.
In summary, call, apply, and bind are powerful methods in JavaScript that allow you to control the value of this inside a function and provide flexibility in passing arguments. Understanding how to use these methods can enhance your code's readability and enable you to create more robust and reusable functions.
Your voice so good , clear and fine
Video is very help full
One important use of bind function is :
When we used a function as callback like setTimeout() , there is chance that method loose reference of object .
So to tightly bind the method with object we can use bind method.
Apart of this.. thanks alot brother for explaining call and apply function very well..
bhai koi real life examplle deke samjh dena please . abhi tk mera clear nhi hua doubt en topic pe
Very well explained ❤
greate tutorial hats of to you sunejaji .. nice-one
bahut ache se ... you are awesome
Please make video for inheritance in JavaScript , before es6 how inheritance was working and with es6 syntax 🙏
very well explained bhaiya 👍
Thanks alot sir 🤗 amazing video
Excellent explanation...
Very good video. Immpressive.
bhai best explanation hai apka.
very well explained sir...
It helped me a lot , thanks
nice explanation with simple real examples....)
@Technical Suneja as another parameter we can take array in call function too so what is difference between call and apply?
Well explained !
Thanks 😅 Awesome video
Thanks for this video sir... please make video on fetch API and this keyword
Sir please make a series of JavaScript tutorials from zero to hero for beginners to expert.
thank you so much sir achhhyyyy se smjh a gya😛💗
pls make video on => What is a deep and shallow copy in JavaScript? What is by default?
Great sir!🙏😊
Very nice explanation
nice sir
The way you explained call,bind and apply....it's fantastic
Keep watching
Thank you so much sir.
LOVELY!
Great 👍
Thank you bhaiya
Content is described simply and in an easy way. Just a suggestion that need to describe definitions of that too. Which make it perfect course. Thanks
+1
Well explained 👍
Amazing Content
Well Described @technical Suneja
Firstly thanks to you to this brief explanation
Just one more point here, That is { Call Apply bind with arrow function}.
I think call, apply and bind will not work with the arrow function because arrow function don't have their own this keyword.
bhaiya backend With node Js interview pr video bnao...☺☺
Will do 🙂
useful content....tq
thank you!!
khatarnaak👌👌
thanks man !
Very good tutorial
Continue this series.....
we support you :)
Pls make more videos on advanced javascript
sir plz make videos on Shallow copy and Deep copy.
great bro
Thanks Sir
Tank you Buddy
Great simple explanantion again, this video could have been a little shorter or you could add some use-case or necessary situation usecase at the end of video. Thanks again
U are great
superb👍
Sir my name is Gajanan. I would like to tell you that your videos are to the point and well explained. I just want to tell you that i have difficulty in finding your playlist for JavaScript. I m following the react js playlist currently on hooks.... if i get a reply will be soo happy.
Thank you so much for your feedback 😊
Will keep uploaded such contents in future .👍
thanku bhai
Thanks u bhia
very owseom
great
Node.js ki bhi aisi short ,simple ,crisp series le aao interview time aa gya h please 🙏
Brother can you make a video please about starting job with .net at 2022, will it be good or not , what will be the scope of .net in future n all
Can anyone explain practical use of this concept where you have applied this in your code
good video nyc
Hi i have one issue with that suppose if we use parameters as array in call() then it is also working why??
Explain real life problems which can be achieved using all the methods pz
11:54 I am surprised.. How ajay n anuj became bhai-bahan. 😊
React native bhi sikhao
Sir jo font size vs code me use kiye hai utna font size console me kar do to ye video agar me Mobil me dekhu to bhi thik se dikhe and Your great sir thanks 😊
nice
like dependency injection concept like call function
Call means we can call any object using call and get it's values and apply means we can store the argument in array and bind means we can make tho copy of the function and Store it in a variable and call when needed is I'm right if not correct me
plz also make some frontend projects using react js .. there are very less video just focusiing on frontend projects using react js.. videos to hai par we sab full stack pe focussed hai .. and jab tak ek beginner frontend hi nhi sikh payeha using react js to in sabhi full stack projects ko kaise kar payega..
Please make video about this keyword
make videos on ruby on rails
Functions declared in tha object are called methods 👻
If we change the regular function to fat arrow function, this keyword works as a window object. WHY?
10/10 marks
Live projects me kya use h ?
Sir we need js project 5 plus..to apply whole js concept into project.because we understd concept but dont know how to apply
just one question , in that problem statement, if we use arrow function , some thing like this
let userDetails ={
name : "Shreyash Kaushal",
age : 28,
designation : "Software Developer",
printDetails : ()=>{
console.log(this.name)
}
}
it doesn't print anything, may i know why ?
Hi,bhai i m fresher UI fullstack develo.. how to prepare for interviews which topic is more imp, and project, please help i confused..... plz reply bhaii
Lekin apply function ma receive side par hum array receive karna ka bajay parameters receive kr rha hn.
Agr hun array bhej rha hn to receive bhi Hume array nai karna hota?
Dsa series lao yar jaldi....🚀🚀