How to create Javascript constants as properties of objects using const keyword?

You cannot do it with constants. The only possible way to do something that behaves like you want, but is not using constants, is to define a non-writable property: var obj = {}; Object.defineProperty( obj, “MY_FAKE_CONSTANT”, { value: “MY_FAKE_CONSTANT_VALUE”, writable: false, enumerable: true, configurable: true }); Regarding your question as to why a const passed … Read more