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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:29:33+00:00 2026-06-01T16:29:33+00:00

I plan to do extension points in a framework im building and i’m finding

  • 0

I plan to do “extension points” in a framework im building and i’m finding a way how i can provide the “core” to an extension so it can add functionality but not exposing the core object that it can be arbitrarily manipulated (i know providing an interface is the better idea) but sill, while i was testing (as well as learning), i wondered why this happens:

(function() {
    var core = {'bar': 'foo'}
    function getCore() {return core;}
    window.kit = {
        core: core,
        getCore: getCore
    }
}());

//initial check
console.log(kit.core)
console.log(kit.getCore());

//change the bar
kit.core.bar = 'baz';

//we will both see 'baz'
console.log(kit.core)
console.log(kit.getCore());

//null the core
kit.core = null;

//this time...
console.log(kit.core)       //core is null on this one
console.log(kit.getCore()); //why is the core still there on this one?​​​​​​​​​​​​
  • 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-01T16:29:34+00:00Added an answer on June 1, 2026 at 4:29 pm

    It’s important to understand the difference between an object and an object reference.

    At the beginning, core and kit.core reference the same object. Any changes to the object itself will reflect in all references to that object. However, if one of the references is changed, the other references are not automatically changed.

    This line:

    kit.core.bar = 'baz';
    

    modifies the object referenced by kit.core and core. The references do not change, but the object does. This is reflected in both references.

    This line:

    kit.core = null;
    

    modifies the reference kit.core to reference null but does not change core, which still references the original object. The object itself does not change.

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

Sidebar

Related Questions

We plan to redesign, improve our (C#) application architecture. Anyone has some framework, hompage
I plan on building a simple, yet high usage webapp and need to settle
I plan on using MySQL and it's built-in encryption functionality to encrypt / decrypt
I am building Chrome extension which at some point should determine current page language.
I am considering using class extension as a way to connect my model with
This may not be possible without writing some crazy extension method which I do
I am creating a chrome extension, where i plan to use OAuth2 client side
I plan to be storing all my config settings in my application's app.config section
I plan to serialize a Django model to XML when it's saved or updated.
I plan to use PyInstaller to create a stand-alone python executable. PythonInstaller comes with

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.