Var

Var is a variable that allows you to set the variable and be able to redefine it multiple times, below is an example of redefining variables

var x = 200
x = 300

//I declared x once then redeclared it and set the new value to 300!

This variable type is useful because it allows us to reuse it multiple times, unlike other variable types like let, and const which cannot be redeclared more than once.

So we can create a variable, that will be set when the bot starts, named MyName and set it to John, notice we have redeclared this variable now it is no longer John!, then we print the new variable value which will output as Anny.

Output
Anny

Last updated