Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6467907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:50:25+00:00 2026-05-25T05:50:25+00:00

I am going through some code left behind by some long-gone developers and came

  • 0

I am going through some code left behind by some long-gone developers and came across this:

Function.prototype.binding = function ()
{
  if(arguments.length < 2 && typeof arguments[0] == "undefined") return this;
  var __method = this, args = jQuery.makeArray(arguments), object = args.shift();
  return function()
  { return __method.apply(object, args.concat(jQuery.makeArray(arguments))); };
};

and it is referenced elsewhere in a couple of places, this DataTables callback function is representitive:

"fnRowCallback": function (nRow, aData, iDisplayIndex)
  {
    nRow = this.options.fnRowCallback(nRow, aData, iDisplayIndex);
    return nRow;
  }.binding(this),

I think that what this is accomplishing is to set the this context in the function to the object passed into the .binding; is that correct? And is this way of doing that considered a good practice?

Thanks,
Matthew

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:50:26+00:00Added an answer on May 25, 2026 at 5:50 am

    I think that what this is accomplishing is to set the this context in the function to the object passed into the .binding

    Correct. Also it optionally accepts some extra arguments, which get passed into the function at call time. So if you did obj.f.binding(obj, 1, 2, 3)(4, 5, 6), the arguments received by obj.f would be 1, 2, 3, 4, 5, 6.

    This method reproduces the standard ECMAScript Fifth Edition method Function#bind, but is named differently, presumably as it is not completely compliant with the interface defined by that method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was going through some code examples and came across this application which which
I was going through some code and came across a scenario where my combobox
i have been going through some code and came across a statement that somehow
I was going through some VC++ code in a large code-base and came across
While going through some C code having inline assembly I came across the .byte
I was going through some old code of mine and came across a hybrid
I was going through some code today and saw this: x.add(getResources().getString(R.string.none)); x.add(getResources().getString(R.string.today)); x.add(getResources().getString(R.string.tomorrow)); ...
I'm going through some code that uses the Oracle OCI and I've come across
I was going through some code at work and I found this inline FLAGS
I was going through some code that I downloaded off the internet ( Got

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.