I've decided to put all my constants in a neat class called constants, and would like to access its members with the dot operator.
So far I've tried:
function Constants(){
Constants.style = {};
Constants.style.border_sides = 20;
Constants.style.button_width = 17;
// ...
}
And later
Constants = new Constants();
and
{
$('#button').width(Constants.style.button_width);
}
That resulted in a
Can't access button_width of undefined.
I would use JSON to declare the constants, but I like comments in my code. Would someone explain javascript's OO?