Javascript Function Variable Scope

Introduction

Demonstrating the impact of variable scope in functions


let a = "apple";

function myFunct() {
    let a = "book";
    console.log(a);   /* w  ww  .ja v  a  2s  . c  o  m*/
}

myFunct();    

console.log(a);



PreviousNext

Related