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

  • SEARCH
  • Home
  • 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 8788301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:07:04+00:00 2026-06-13T22:07:04+00:00

I tried the following in the Google Chrome console: > function t1(f) { return

  • 0

I tried the following in the Google Chrome console:

> function t1(f) { return f(1); }
> function t2() { return this+1; }
> t1(t2.call)
TypeError: object is not a function

Why does this not work? Is there a way to define a function in lieu of Function.prototype.call that would work here?

  • 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-06-13T22:07:05+00:00Added an answer on June 13, 2026 at 10:07 pm

    It doesn’t work because when you’re passing t2.call, you’re actually just passing .call. In other words, it doesn’t remember the object from which it was passed.


    To accomplish what you wanted, you can use .bind().

    t1(t2.call.bind(t2))
    

    This binds the t2 function as the this value of .call, which means you’ll be calling .call as though you had done this:

    t2.call
    

    …which is what you wanted.


    The .bind method is not supported in IE8 and lower, as well as some other older browsers, but you can implement a mostly complete shim in those cases.


    FYI, if you need this a lot, you could bind .call as the calling context of .bind to shorten it a bit.

    var callBind = Function.prototype.bind.bind(Function.prototype.call);
    

    So now you have a .bind() function with .call() bound as its calling context. When you invoke it, it will be as if you were doing this:

    .call.bind(/* the function */)
    

    So callBind() will return a function with the function bound as the calling context of .call, just like we did above. So you’d use it like this:

    t1(callBind(t2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried following the answer to this question , but could not get xsd.exe
The following code works in Google Chrome and Firefox, but don't work in IE8.
In Google Chrome browser, i have tried several way + following and none is
I tried following the advice gathered from Google searches but I am not able
Tried following the instructions here: How to use Google app engine with my own
I tried to create a new folder following the instructions at https://developers.google.com/google-apps/documents-list/#creating_a_new_document_or_file_with_metadata_only instead of
I tried following the instruction s but can't get the plugin to work, the
I tried following the gradle manual with their example like this but copyJars is
I am currently fighting Google Chrome on the following action: location.href = url location.replace(url)
The error When the user opens http://sync.aws.af.cm/ , the Google Chrome JavaScript Console shows

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.