let is a keyword used to declare variables in JavaScript.
Let:
The let keyword was introduced in ES6 (2015).
Variables declared with let have Block Scope.
Using let, we can declare the variable and initialize it later.
<script>
let a;
</script>
- But, declare the value before using that variable. Otherwise it show Undefined.
What is Undefined?
undefined is a special value in JavaScript that means a variable has been declared, but no value has been assigned to it yet.
<script>
let a;
console.log(a);
</script>
Output:
Undefined
Re-initializing a value for let variable is possible.
<script>
let a;
a="Raksha";
a="Raji";
console.log(a);
</script>
Re-Declaring the let variable is not possible, if we try to re-declare the variable it shows the **Uncaught SyntaxError**
Error:
Excited to continue learning and building with JavaScript!



Top comments (0)