Defines multiple constant properties on an object at once
Optional
target
const config = {};defineConstants(config, { API_URL: 'https://api.example.com', MAX_RETRIES: 3, TIMEOUT: 5000});config.API_URL = 'new-url'; // Will not change the valueconsole.log(config.API_URL); // 'https://api.example.com' Copy
const config = {};defineConstants(config, { API_URL: 'https://api.example.com', MAX_RETRIES: 3, TIMEOUT: 5000});config.API_URL = 'new-url'; // Will not change the valueconsole.log(config.API_URL); // 'https://api.example.com'
Defines multiple constant properties on an object at once