By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

unique number for each object?

P: n/a
Hi,

Is there an internally assigned number for each JavaScript object that
I can read? If so how would I do that?

Thanks,
Peter

Jun 12 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
petermich...@gmail.com wrote:
Is there an internally assigned number for each JavaScript object
that I can read? ...


No. If you want unique identifiers for JS objects you have to create
them yourself (and it is useful to think about how unique they need to
be before you start).

Richard.

Jun 12 '06 #2

P: n/a


pe**********@gmail.com wrote:
Is there an internally assigned number for each JavaScript object that
I can read? If so how would I do that?


There is no hash code which some other languages provide.
IE/Win gives you a generated id on each element node in the DOM, see
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/uniqueid.asp>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 12 '06 #3

P: n/a

Richard Cornford wrote:
petermich...@gmail.com wrote:
Is there an internally assigned number for each JavaScript object
that I can read? ...


No. If you want unique identifiers for JS objects you have to create
them yourself (and it is useful to think about how unique they need to
be before you start).

Thanks Richard,

What unexpected considerations need to be made when making a unique id?
I am currently using a prefix and a counter together as a string for
the identifier. The counter increments each time a constructor makes a
new object.

Peter

Jun 12 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.