Difference between var and let
Rehman Shahid
Select an image from your device to upload
if we will declare a let inside function then we cant access that outside of the fucntion .
The var keyword is called function-scoped while let is block-scoped variables.
When JavaScript reads your variable declarations that uses the var are lifted to the top of local scope (if declared inside a function). Otherwise lifted to the top of the global scope (if declared outside a function).
Lastly, let are accessible inside the block to where it was defined.