In a project I am working on, we have a script with an 'enumeration' object in it, as such:
var MyEnumeration = {
top: "top",
right: "right",
bottom: "bottom",
left: "left"
};
When we have to use something that would use one of those literal values, we just do a comparison to MyEnumeration.left or whatever the case is.
However: At least in C#, string values usually evaluate more slowly than numbers, since strings have to do a character-for-character comparision to ensure that string A matches string B.
This brings me to my Question: Would implementing MyEnumeration with number values perform more quickly?
var MyEnumeration = {
top: 0,
right: 1,
bottom: 2,
left: 3
};