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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:58:45+00:00 2026-06-16T11:58:45+00:00

I am having a little trouble understanding why Result is false in the following

  • 0

I am having a little trouble understanding why Result is false in the following code.

Other objects in the library that are required to have a size will check if the size parameter is an instance of InterfaceKit.Core.Size. Currently, instanceof is returning false.

var InterfaceKit = {
    Core : {
        Size: function( i_Width, i_Height ){
            Object.defineProperties(this, {
                m_Width : {
                    value: Number( i_Width ) ? Number( i_Width ) : 0
                    , writable: true
                }
                , m_Height : {
                    value: Number( i_Height ) ? Number( i_Height ) : 0
                    , writable: true
                }

            }); 

            this.__proto__ = {
                SetWidth: function( i_Width ){
                    if( Number( i_Width ) )
                        this.m_Width = Number( i_Width ); 

                }
                , GetWidth: function(){
                    return this.m_Width; 
                }
                , SetHeight: function( i_Height ){
                    if( Number( i_Height ) )
                        this.m_Height = Number( i_Height ); 

                }
                , GetHeight: function(){
                    return this.m_Height; 
                }

            };

            this.__proto__.constructor = InterfaceKit.Core.Size; 

        }

    }

}; 

var Result = (new InterfaceKit.Core.Size( 10, 10 ) instanceof InterfaceKit.Core.Size); //false
  • 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-16T11:58:46+00:00Added an answer on June 16, 2026 at 11:58 am

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/instanceof

    The instanceof operator tests whether an object has in its prototype chain the prototype property of a constructor.

    In other words…

    // an objects prototype chains has this as the root
    object.__proto__ // set to: {}
    
    // the prototype property of the constructor
    A.B.prototype // unmodified prototype, some object set by JS engine. Probably: {}
    
    // Equivalent objects are not equal, because they are different objects
    {} === {} // false
    

    Therefore the constructor’s prototype is not in the prototype chain of the object. Which means it is not an instanceof the constructor, even if that constructor did “construct” that object.


    But really, just don’t use __proto__.

    var A = {
        B: function() {}
    };
    A.B.prototype = {};
    
    var Result = (new A.B() instanceof A.B); // true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a little trouble understanding migrations in Ruby on Rails. I have
I am having a little trouble understanding this simple for loop code. I just
I am having a little trouble understanding the rationale behind the following few pieces
I'm having a little trouble understanding how I would use covariance and contravariance in
I'm having a little trouble in understanding how I can read and return the
I am having a little trouble understanding ServiceKnownType in WCF. Taken from this blog
Im working on a CS assignment and Im having a little trouble understanding how
I'm having some a little trouble understanding how to handle the database end of
I am having a little trouble understanding what config/routes actually routes to. For example
Im having a little trouble setting up routes. I have a 'users' controller/model/views set

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.