Skip to content

Instantly share code, notes, and snippets.

@rahulmalhotra
Created August 30, 2020 13:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rahulmalhotra/7a3444ecfae2d6f75f5b146a009d68a2 to your computer and use it in GitHub Desktop.
This code snippet is being used in Everything about constants in JavaScript Tutorial on SFDC Stop
// * Constants in Javascript
// * Initialize a constant while defining it
const MONUMENT = 'Taj Mahal';
console.log(MONUMENT);
// * Constant can only be initialized once, at the time of definition
// MONUMENT = 'Lal Quila';
// console.log(MONUMENT);
// * We can assign an object to a constant
const USER = {
firstName : 'Rahul',
lastName : 'Malhotra'
};
console.log(USER);
// USER = {
// firstName : 'Richard',
// lastName : 'Hendricks'
// };
/*
* If a constant is an object, then I cannot update that whole constant
* but we can update the properties of that constant
*/
USER.firstName = 'Richard';
USER.lastName = 'Hendricks';
console.log(USER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment