Understand String Immutability
See original GitHub issueChallenge Understand String Immutability has an issue.
User Agent is: Mozilla/5.0 (iPad; CPU OS 10_1_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/54.0.2840.91 Mobile/14B100 Safari/602.1
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// Setup
var myStr = "Jello World";
// Only change code below this line
myStr[0] = "J"; // Fix Me
This challenge won’t let me submit the answer even if it’s wrong. It reads a “TypeError: Attempted to assign to readonly property.” On the JavaScript console where my answer should be when I submit. Is this broken?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Understand String Immutability - CodeChallenge - GitHub
In JavaScript, String values are immutable , which means that they cannot be altered once created. For example, the following code: var myStr...
Read more >Understand String Immutability - The freeCodeCamp Forum
Mhm, as the description of the challenge says, strings are immutable even if they're iterable like arrays. But strings being iterable can be ......
Read more >Javascript String Immutability - Medium
Javascript String is immutable, which means once a String object is assigned to String reference the object value cannot be changed.
Read more >Immutable String in Java - javatpoint
Once String object is created its data or state can't be changed but a new String object is created. Let's try to understand...
Read more >Why String is Immutable or Final in Java? Explained
The string is Immutable in Java because String objects are cached in the String pool. Since cached String literals are shared between multiple...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
HI i am stuck on this challenge as well. I rewrote the string as “Hello World” and still no luck. this is my code
Edit: not sure if this is the intended challenge but deleting the line myStr[0] =“H” seems to work``
// Setup var myStr = “Hello World”;
// Only change code below this line var myStr = “Hello World”; myStr = “Hello World”;
This will work I think. Good luck.