Login
Remember
Register
Ask a Question
What are the different ways in which you can define a JavaScript variable?
0
votes
asked
Sep 19, 2021
in
JavaScript
by
sharadyadav1986
What are the different ways in which you can define a JavaScript variable?
javascrript-variable
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Sep 19, 2021
by
sharadyadav1986
There are 3 ways:
Var – The JavaScript variable statement helps to declare a variable. Alternatively, it can also be used to initialize the value of that specific variable.
Const: The const functions are used so as to not allow the modification of the object on which it is called. So, when a function is said to be const, the function can be called on any object type.
Let: Let is used as a signal that shows that a variable can be reassigned, like a counter in a loop or that value swap within an algorithm.
...