Javascript call apply vs bind

0 votes

I'm already aware that apply and calls are functions that do the same thing (context of a function).

The distinction is in how we communicate the arguments (manual vs array). When should I, however, utilize the bind() method?

var obj = {
  x: 81,
  getX: function() {
    return this.x;
  }
};

alert(obj.getX.bind(obj)());
alert(obj.getX.call(obj));
alert(obj.getX.apply(obj));
Sep 22, 2022 in Java by Nicholas
• 7,760 points

edited 5 days ago 6 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP