0 votes
in JavaScript by
What are the different ways in which you can define a JavaScript variable?

1 Answer

0 votes
by

There are 3 ways:

  1. Var – The JavaScript variable statement helps to declare a variable. Alternatively, it can also be used to initialize the value of that specific variable. 
  2. 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.
  3. 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. 

Related questions

+1 vote
asked Jan 27, 2020 in JavaScript by AdilsonLima
+1 vote
asked Dec 4, 2019 in JavaScript by SakshiSharma
...