Question about declaration/intended solution for Strings 4 skill test

I have questions about about declaration choices here as well as the intended solution.

link to the skill test in question:

The prompt:

We want you to change the value of [myString] as follows:


const myString = 'Using *, we can work out that that if the two shortest sides of a right-angled triangle have lengths of * and *, the length of the hypotenuse is *.';

and later:

// Don't edit the code below here!
para1.textContent = myString;
  1. As far as I understand, strings are immutable — so it seems that the prompt of “changing the values of the string” doesn’t make sense from the start. The solutions that made sense to me were either changing the declaration of myString to use let or change the declaration using const to some other name (e.g. startingString) and then created myString from that (e.g. let myString = startingString;)
  2. My first solution was to iteratively go through and use the .replace() method on the string but that feels error prone/clunky. I looked through the documentation for .replace() and it feels like using a regex might make sense, but that feels like a quite different solution (

Hi @bingbong and welcome to the community :wave:

Congratulations on getting this crazy regex to work!

This is a classic case of a misunderstanding and then thinking waaay to far. :slightly_smiling_face: When the task says

We want you to change the value of the string as follows:

they literally mean “changing this very line of code”. So the solution starts with

const myString = `Using ${ theorem }, we can ...

On the positive side you probably learned a lot about regex while coding your solution :grin: Great dedication for sure!

Have a nice day,