Click to See Complete Forum and Search --> : Enumerated Types


TNO
12-05-2006, 02:39 AM
JScript .NET introduces the enum statement that allows you to construct enumerated data types:

http://www.webreference.com/js/column108/4.html

So my question is, what do you consider to be a good substitute for this pre-ECMA 4? An associative array?

mrhoo
12-05-2006, 09:41 AM
You can limit an objects property set when you create it, and you can run an object through a sifting method to discard disallowed values before you use it,
but in javascript there is no global type enforcement-
you can always and any time add properties and values that
wouldn't be allowed in a strictly typed language.