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 7956195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:55:20+00:00 2026-06-04T03:55:20+00:00

I am just curious whether I can include an object into function prototype chain.

  • 0

I am just curious whether I can include an object into function prototype chain. What I mean:

var test = function() { return 'a'; };

console.log(test.bind(this)); // return new bound function

// changing the prototype
// in console the prototype is really set as needed
// test => new object => function prototype => Object prototype
var F = function() {};
F.prototype = Function.prototype;
test.prototype = new F();

console.log(test.bind()); // this still works and returns new bound function

test.prototype.bind = function() {
    return 'test';
};

console.log(test.bind()); // this does not work as expected -> returns new bound function instead of 'test'. When I do delete Function.prototype.bind, then console.log(test.bind) returns undefined
  • 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-04T03:55:21+00:00Added an answer on June 4, 2026 at 3:55 am

    You have a function test. It is a instanceof Function, and inherits from Function.prototype so that you can call test.bind for example.

    Then you set the “prototype” property of your function to an object inheriting from Function.prototype. That means that all instances of test will inherit from that object (and from Function.prototype):

    var t = new test;
    t instanceof test; // => true
    t instanceof Function; // => true
    

    Then you overwrite the test property on your custom prototype object. You do good to do so, because Function methods should only be called on functions (i.e. callable objects):

    >>> Function.prototype.bind.call({})
    Unhandled Error: Function.prototype.bind: this object not callable
    

    In your tests with console.log you only apply the Function methods on your test function, not on instances of it. Good, because they’d fail. So, I can see no reason why any objects should inherit from Function – you can’t construct functions that don’t inherit directly from Function.

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

Sidebar

Related Questions

Hi I am just curious to know whether different users can have same user
Just curious. How does actually the function Sleep() work (declared in windows.h)? Maybe not
Just curious to find out exactly what problems I'll cause myself if I include
I'm just curious about whether this is possible - I know how to download
I'm just curious as to whether such as tool exists (free, open source, or
I'm curious as to whether one can define a Java class purely using a
I'm curious as to how many of these queue methods I can encapsulate into
Just curious whether concepts like load-balancing are going away since cloud hosting seems to
I'm just curious about whether or not I have to call this on the
Edit: I'm really just curious as to how I can get this regex to

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.