mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-05 09:01:18 -04:00
Better wording of exercise description (#47431)
Update mutate-an-array-declared-with-const.md Fixed unclear part of the exercise description. As cited by user [in the forum](https://forum.freecodecamp.org/t/cannot-understand-the-following-line-in-question/549786/3)
This commit is contained in:
@@ -23,7 +23,7 @@ s[2] = 45;
|
||||
console.log(s);
|
||||
```
|
||||
|
||||
`s = [1, 2, 3]` will result in an error. The `console.log` will display the value `[5, 6, 45]`.
|
||||
`s = [1, 2, 3]` will result in an error. After commenting out that line, the `console.log` will display the value `[5, 6, 45]`.
|
||||
|
||||
As you can see, you can mutate the object `[5, 6, 7]` itself and the variable `s` will still point to the altered array `[5, 6, 45]`. Like all arrays, the array elements in `s` are mutable, but because `const` was used, you cannot use the variable identifier `s` to point to a different array using the assignment operator.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user