2018-10-12 15:37:13 -04:00
---
title: Understand String Immutability
---
2019-07-24 00:59:27 -07:00
# Understand String Immutability
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
---
## Hints
### Hint 1
2019-01-15 14:52:33 -08:00
Instead of ```Jello World ` ``, ` ``myStr` `` should be assigned ` ``Hello World` ``.
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
---
## Solutions
< details > < summary > Solution 1 (Click to Show/Hide)< / summary >
2019-01-15 14:52:33 -08:00
```javascript
// Setup
var myStr = "Jello World";
2019-07-24 00:59:27 -07:00
// Only change code below this line
myStr = "Hello World";
2019-01-15 14:52:33 -08:00
```
2019-07-24 00:59:27 -07:00
#### Code Explanation
2019-01-15 14:52:33 -08:00
String literals such as ```"Jello World"` `` cannot be changed by the individual letter (hence being *immutable*), so the variable containing the incorrect string must be replaced with the desired string using the assignment operator ` ``=` ``
2019-07-24 00:59:27 -07:00
< / details >