var Days = {"sunday" : 0, "monday" : 1, "tuesday" : 3, "wednesday" : 4, "thursday" : 5, "friday" : 6, "saturday" : 7};
document.write(Days.friday);
Example 2:
function Enum() {}
Enum.ColorType = {red:0, blue:1, green:2}
document.write(Enum.ColorType.blue);
Example 3:
var enumObj = new Object();
enumObj.fontSize = {small:10, medium:12, large:14}
document.write(enumObj.fontSize.small);
Thanks,
InfoSource: http://programming.top54u.com/post/Creating-Javascript-Enum-values.aspx
No comments:
Post a Comment