1.0 KiB
Redeclaration of Love 💕
Assign, re-assign
Remember the let
keyword used to declare new variables.
Note that we can't have multiple variables with the same identifier otherwise JS wouldn't know which one is which.
Redeclaring a variable will crash !
But it is still possible to use the =
(assignation operator) to change its
value !
Instructions
The variable love
has been declared and will be used during the tests.
You must try to re-assign the love
variable to the string value
I still love you !!
but without re-declaring it !
Note that sometimes you may find variable declared with
const
. This means that the assignation is constant and can never be re-assigned !It is used to protect your code against errors, but you can always use
let
in its place.Also you may find online old code using
var
. We are trying to get rid ofvar
's since 2015. It's ancient syntax and it was pretty problematic. Never use it! If you see code using it, try to find a more recent example. This one is outdated.