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

1 Answer

0 votes

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

0 votes
asked Nov 9, 2021 in Python Pandas by Robin
0 votes
asked Oct 19, 2019 in JavaScript by SakshiSharma
+1 vote
asked Dec 4, 2019 in JavaScript by SakshiSharma