Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

let and var difference

function run() {
  var foo = "Foo";
  let bar = "Bar";

  console.log(foo, bar);

  {
    let baz = "Bazz";
    console.log(baz);
  }

  console.log(baz); // ReferenceError
}

run();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #var #difference
ADD COMMENT
Topic
Name
4+6 =