"let" variable in JavaScript .



What are the "let" variables in JavaScript ?

These variables are limited to relevant scope.It means we can't use these variables outside of  scope. But var variables are global variables in java script.

ex :
        function(){
            let status=5;
            console.log(status);
        }
        console.log(status);

The status variable is valid only for scope of function.It can't be used in outside.

No comments:

Post a Comment