<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to do enumerations (enum) in javascript</title>
	<atom:link href="http://www.javascriptkata.com/2007/03/22/how-to-do-enumerations-enum-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javascriptkata.com/2007/03/22/how-to-do-enumerations-enum-in-javascript/</link>
	<description>Advanced katas for javascripters</description>
	<lastBuildDate>Fri, 30 Jul 2010 18:10:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Nicolas</title>
		<link>http://www.javascriptkata.com/2007/03/22/how-to-do-enumerations-enum-in-javascript/comment-page-1/#comment-753</link>
		<dc:creator>Nicolas</dc:creator>
		<pubDate>Wed, 20 May 2009 15:32:40 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=9#comment-753</guid>
		<description>A problem with using numbers is:

var colors = {red:0, blue:1, green:2};
var days = {sunday:0, monday:1, tuesday:2, wednesday:3, thursday:4, friday:5, saturday:6};

colors.red == days.sunday!

You can avoid mixing numbers with real values of the enum by using this:
var colors = {red:{}, blue:{}, green:{}};

This creates empty objects to use as enum values. They can only compare with themselves. They will never be equal to anything else, like value of another enum.</description>
		<content:encoded><![CDATA[<p>A problem with using numbers is:</p>
<p>var colors = {red:0, blue:1, green:2};<br />
var days = {sunday:0, monday:1, tuesday:2, wednesday:3, thursday:4, friday:5, saturday:6};</p>
<p>colors.red == days.sunday!</p>
<p>You can avoid mixing numbers with real values of the enum by using this:<br />
var colors = {red:{}, blue:{}, green:{}};</p>
<p>This creates empty objects to use as enum values. They can only compare with themselves. They will never be equal to anything else, like value of another enum.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
