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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:55:46+00:00 2026-06-10T05:55:46+00:00

var obj = {a:1,b:2}; function parent_object(num){ console.log(‘This number is inside the object ‘,<????>); }

  • 0
var obj = {a:1,b:2};
function parent_object(num){
    console.log('This number is inside the object ',<????>);
}
parent_object(obj.a)

This should output pointing to obj. The only way I found to do this is boxing every number object in an object which would keep a reference to the parent. This is, though, a performance killer. Is there a better way of keeping track of the location of a number?

  • 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-10T05:55:48+00:00Added an answer on June 10, 2026 at 5:55 am

    Actually no. And not only in JavaScript, but in none of the other conventional languages.

    As far as I know, the only way would be for you to do exactly what you yourself said: boxing the number (or any other field type) in an object that would keep a reference (maybe by constructor injection) to its enclosing parent.

    The boxing in question can be thus accomplished:

    BoxedValue = function(value, parent) {
        this.value = value;
        this.parent = parent;
    }
    
    var i = {};
    n.i = new BoxedValue(12, i)
    console.log(i.n.parent);
    

    However, generally speaking, the most important factor in your JavaScript application’s performance for current browsers is the way you handle your memory usage. Therefore, this approach isn’t really advisable, and I suggest you solve your problem, whatever it might be, via some other method.

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

Sidebar

Related Questions

This is my object : var obj = { a:{ x:1 y:function(){return this.x //works
I have this code: var obj = function (i) { this.a = i; this.init
So there is this function Array.prototype.containsCaseInsensitive = function(obj) { var i = this.length; while
I have an on object like so var obj = {}; function set() {
I'm passing this inside an each loop (DOM object) to another function but in
I have this code (JSFiddle) var OBJ = function(){ var privateVar = 23; var
I have a model named person: var person = Backbone.Model.extend({ initialize: function(){ console.log('cool'); },
<script type=text/javascript> var a = new Array(); function obj(type, value) { this.type = type;
For the following JavaScript: function EscapedString(str) { var obj = document.createElement(span); obj.innerHTML = str;
Hi I have written below code function unique(th){ var obj = {}; for(var i

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.