How do I get a numeric or string value for a javascript object such as window instead of the string [object]
Looking for something like an object id, like 44001 or 0xFF0012 that is unique for that object
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Javascript doesn’t keep a python-like unique hash for each object. You could create a function to assign a unique string to an object, or retrieve the string if it’s already been assigned.
Testing it out:
You can do console.dir(getUniqueId.knownObjects) for some useful debugging info.