Use Object.freeze for constants file in js
When I create constants file in JS, I usually use Object.freeze(). It's easy to use and prevents you from accidentally changing your constants. Example:
module.exports = Object.freeze({
name: "Hanki",
emoji: "🤙",
url: "https://hanki.dev",
});
Usage:
const constants = require("./constants");
console.log(constants.name);