Theme
Primary Color
Lesson 2

New Way To Create Variable - Let

محتوى الدرس

/*
  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

*/

var osama = 1;
let ahmed = 2;

console.log(window.osama)
console.log(window.ahmed)

console.log(this.ahmed)
console.log(this.ahmed)

console.log(window)
console.log(this)