We can also use
const to create a variable and store a value in it.
In the example given below, the variable
fruit stores the value
There are two things that we must keep in mind when we use
We can’t change the value of a
We must give a value to it as soon as we create it.
In the example given below, when we try to change the value of the variable
fruit, it throws an error.
If we create a variable using
const and do not provide it a value instantly, it throws an error.