Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what to use let vs var js

/* DIFFERENCE BETWEEN LET AND VAR */

//LET EXAMPLE
{
  let a = 123;
};

console.log(a); // undefined

//VAR EXAMPLE
{
  var a = 123;
};

console.log(a); // 123
 
PREVIOUS NEXT
Tagged: #var #js
ADD COMMENT
Topic
Name
2+7 =