Static Constants

A static field is writable, so static OK = 200 is not a constant. The classic fix is a static get with no setter; alternatively, freeze the class in a static block placed after the fields. In strict code (modules and class bodies) every write then throws a TypeError; sloppy scripts ignore it. Freezing is shallow.

Read-only static constants (an ES module)JavaScriptLive
class Http {
  static OK = 200;                                       // writable by default
  static get NOT_FOUND() { return 404; }                 // getter without setter
  static { Object.freeze(this); }                        // runs after the fields: lock them
}
const write = (key) => { try { Http[key] = 0; return 'ok'; } catch (e) { return e.name; } };
console.log(['OK', 'NOT_FOUND', 'NEW'].map(write), Http.OK, Http.NOT_FOUND);  // strict module