Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript enumeration

Status
Not open for further replies.

xpblueScreenOfDeath

Programmer
Sep 1, 2004
87
0
0
Can some help explan what I am doing wrong and how to fix it. I couldn't figure how to use javascripts enumeration.

Code:
enum abc
{
  a,
  b,
  c
}

alert(abc.a);
 
As far as I know, and as far as I've been able to research, Javascript doesn't use the reserved word enum. You need JScript .NET for that to work.

Lee
 
I've not come across it before in JS either, although Quackit says it's an ECMAScript reserved word.

As JavaScript and JScript are extensions to ECMAScript, it follows that ECMAScript reserved words are also reserved in J/JavaScript...But I'm not convinced that's the case here.

Wikipedia has a reasonable ECMAScript article.

---
Marcus
better questions get better answers - faq581-3339
accessible web design - zioncore.com
 
There are a lot of reserved words in ECMAscript (and Javascript/JScript) that aren't actually used. Usually they're reserved for future enhancements to the language (like class, extends, private, etc.).

What you showed about looks suspiciously like JSON (JavaScript Object Notation).

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top