Theme
Primary Color
Lesson 3

New Way To Create Variable - Const

محتوى الدرس

/*
  let, const

  var
  - Function Scope
  - Can Be Redeclare
  - Undefined When Accessing A Variable Before It's Declared
  - Create Properties in The Window Object

  let
  - Block Scope
  - Cannot Be Redeclare
  - Reference Error When Accessing A Variable Before It's Declared
  - Does Not Create Properties in The Window Object

  const
  - Block Scope
  - Cannot Be Redeclare
  - Reference Error When Accessing A Variable Before It's Declared
  - Does Not Create Properties in The Window Object

*/

const SETTINGS = {
  'name' : 'Osama',
  'age': 36
};

Object.freeze(SETTINGS);
SETTINGS.name = 'Sayed';
console.log(SETTINGS);