I know there are no constants in JavaScript however I would like to separately store configuration values to make them easy to find and tweak.
- Create a separate
$.Class
and store the key-value pairs in the static part - Or have them read from a JSON configuration file
- Or something better
I would go with option #2. I guess JSON is more readable than extending a class with static properties.
However, I would not read the JSON in with a XHR, but just design it as JSONP. The JSON then practically gets an object literal, which can be assigned to any static variable of your application. You even could build static class properties from it by using a padding function like
$.extend(MyClass, {…});
.