There is no enumeration type in JavaScript. However, you could wrap the object using the get and setter method, for example
var value = (function() { var val; return { 'setVal': function( v ) { if ( v in [ listOfEnums ] ) { val = v; } else { throw 'value is not in enumeration'; } }, 'getVal': function() { return val; } }; })();
Sirko
source share