mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
4 years ago
|
## 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 of
|
||
|
> `var`'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.
|