I am developing something in JS and I need to sort data as static variables in, I remembered a way to do this in java with the Enum , the thing I investigated is that there is no enum in js (?), so I tried to create an object
var baseValue = {
kb = 1024.0,
mb = 1048576,
gb = 1099511627776
};
(it should be noted that I have not worked much on this in JS )
I try to get one of the values like this
alert(baseValue.kb);
but it gives me the error Invalid shorthand property initializer
What you are actually doing is defining an object with properties, and the syntax for specifying the properties in the object definition in javascript is con
:
not con=
: