question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Understand String Immutability

See original GitHub issue

Challenge 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? img_0002

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Sean-Cancommented, Jan 18, 2017

HI i am stuck on this challenge as well. I rewrote the string as “Hello World” and still no luck. this is my code

// Setup
var myStr = "Hello World";

// Only change code below this line
myStr = "Hello World";
myStr[0] = "H";

Edit: not sure if this is the intended challenge but deleting the line myStr[0] =“H” seems to work``

0reactions
mustafizrahman8807commented, Dec 1, 2018

// 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found