GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-Dec-2006, 18:36
Blake's Avatar
Blake Blake is offline
Regular Member
 
Join Date: Nov 2005
Posts: 330
Blake is a jewel in the roughBlake is a jewel in the roughBlake is a jewel in the rough

enum in JavaScript


I would like to do a C++ like enum in JavaScript. As far as I can tell, there's no built in way of doing it. I'm wondering if there's a standard way of doing the equivalent of an enum.

This is what I've come up with:
Code:
var opTypes = { PLUS : 0, MINUS : 1, RESULT : 2, NONE : 3 } var op = opTypes.NONE;

This is suppose to be the equivalent of:

CPP / C++ / C Code:
enum opTypes {PLUS, MINUS, RESULT, NONE};
opTypes op = NONE;

The entire file is located here. It's a binary calculator.

Thanks!
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
We're looking for JavaScript codes / mini tutorials. JdS Web Design Forum 8 23-Nov-2008 03:27
Alternatives to programming in javascript and HTML Salil Web Design Forum 5 10-Mar-2006 22:37
An Introduction to Javascript JasonMichael Web Design Forum 2 24-Oct-2004 10:19
javascript menu dopee Web Design Forum 7 30-Jul-2004 23:22
JavaScript Tutorial Part 1 pcxgamer Web Design Forum 2 01-Dec-2003 09:16

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:17.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.