In JavaScript, you can declare a variable using the var, let, or const keywords.
Here’s how to declare a variable using these keywords:
1. The “var” keyword:
```
var a = 10;
```
1. The “let” keyword:
```
let a = 10;
```
1. The “const” keyword:
```
const a = 10;
```
In all these examples, `a` is the variable, and `10` is the value assigned to it.
Difference between var, let and const:
- var is function scoped, it means a variable can be accessible within the function it was declared.
- let and const are block scoped, it means a variable can only be accessed within the block it was declared.
- let allows you to reassign values to the variable.
- const doesn’t allow reassignment, meaning that once you assign a value to a const variable, you cannot change it later. However, it doesn’t make it immutable, if the const variable holds an object, properties of this object can be changed.