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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:10:55+00:00 2026-05-13T10:10:55+00:00

Do JavaScript objects/variables have some sort of unique identifier? Like Ruby has object_id .

  • 0

Do JavaScript objects/variables have some sort of unique identifier? Like Ruby has object_id. I don’t mean the DOM id attribute, but rather some sort of memory address of some kind.

  • 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-05-13T10:10:56+00:00Added an answer on May 13, 2026 at 10:10 am

    No, objects don’t have a built in identifier, though you can add one by modifying the object prototype. Here’s an example of how you might do that:

    (function() {
        var id = 0;
    
        function generateId() { return id++; };
    
        Object.prototype.id = function() {
            var newId = generateId();
    
            this.id = function() { return newId; };
    
            return newId;
        };
    })();
    

    That said, in general modifying the object prototype is considered very bad practice. I would instead recommend that you manually assign an id to objects as needed or use a touch function as others have suggested.

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

Sidebar

Related Questions

I have a javascript object which has some defined variables and attaches some event
Javascript functions are objects and they have scope chain associated with them. If some
I am facing a problem with JavaScript objects. I have some text on a
I have some problems figuring out how to group to certain variables in javascript.
Does Javascript have a built-in syntax for selecting multiple variables? Say I'd like to
I have two javascript objects: var a = { x: 1, y: { faz:
I have an array of JavaScript objects: var objs = [ { first_nom: 'Laszlo',
I have a pretty big Javascript script with loads of global variables & functions
While developing widgets (objects, which - rendered - use some custom javascript files), I
I have some javaScript Classes ( ctor+prototype methods) that I want their instances 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.