You need to wrap the text Store in double quotes. Because your string is already wrapped in double quotes, you’ll need to escape the quotes around Store. You can escape them with a backslash \ . Here is an example:
// The Example below:
const escapedString = “Naomi likes to play "Zelda" sometimes.”;
Wrap the text Store in double quotes within your text.innerText line. //
// This what I did. I did it in multiple ways & still came out wrong. please help me so I may move on Thank You my fellow coder. //
function goTown() {
Attempt 1: button1.innerText = "Go to \ "store\ “.”; ( Wrong )
Attempt 2: button1.innerText = "Go to \ "store\ ". ; ( Wrong )
Attempt 3: button1.innerText = "Go to \ "store\ "; ( Wrong )
Attempt 4: button1.innerText = "Go to \ “store”\ ; ( Wrong )
Attempt 5: button1.innerText = "Go to \ “store”\ "; ( Wrong )
}
& with that I give up
// Below Is the original //
function goTown() {
button1.innerText = “Go to store”;
button2.innerText = “Go to cave”;
button3.innerText = “Fight dragon”;
button1.onclick = goStore;
button2.onclick = goCave;
button3.onclick = fightDragon;
text.innerText = “You are in the town square. You see a sign that says Store.”;
}
I have updated your post to include the challenge so we can better assist you.
When asking questions on the forum, it is important to include this link.
Also, here is how to add code to the forum without having to use a bunch of > before each line of code.
When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Hello Wilkins. So I’ve tried & still nothing. I’ve wrapped Store like this
\"store\";
The same way how the word Zelda is supposed to be displayed in the example shown in the prompt which is this
const escapedString = “Naomi likes to play \"Zelda\" sometimes.”;
For mines it doesn’t go through & the semicolon doesn’t turn dark like it’s suppose to, at the end of each line of code. Instead it becomes the same color as the entire string before it. So I’m confused
You need to wrap the text Store in double quotes. Because your string is already wrapped in double quotes, you’ll need to escape the quotes around Store . You can escape them with a backslash \ . Here is an example:
The Example Below:
const escapedString = "Naomi likes to play \"Zelda\" sometimes.";
Now I will show you all the attempts I did to get this correct & They still ALL came out wrong.
Attempt #1 below: I do it just like Zelda but it doesn’t pass & the semicolon becomes the same color as the string.
function goTown() {
button1.innerText = "Go to \"store\";
Attempt #2 below: I add a period to see. The semicolon becomes dark but still doesn’t pass.
function goTown() {
button1.innerText = "Go to \"store\".";
Attempt #3 below: I put the 2nd Double Quote inside to see. Semicolon is dark. Doesn’t pass.
function goTown() {
button1.innerText = "Go to \"store"\;
Attempt #4 below. I realized Store in the prompt has a capital S. So I write it like these
function goTown() {
button1.innerText = "Go to \"Store\";
function goTown() {
button1.innerText = "Go to \"Store;
Moral of the story is I’ve done enough attempts to try & pass this step & nothing is working. It’s about to be a full day. I would just like to be told what it is just so I could move on from this but of course you may help me spot out the problem because I’m very confused & a bit annoyed
function goTown() {
button1.innerText = "Go to store";
button2.innerText = "Go to cave";
button3.innerText = "Fight dragon";
button1.onclick = goStore;
button2.onclick = goCave;
button3.onclick = fightDragon;
text.innerText = "You are in the town square. You see a sign that says Store.";
}
function goTown() {
button1.innerText = "Go to store";
button2.innerText = "Go to cave";
button3.innerText = "Fight dragon";
button1.onclick = goStore;
button2.onclick = goCave;
button3.onclick = fightDragon;
text.innerText = "You are in the town square. You see a sign that says Store.";
}
You should only add the \" for the string on the line that starts with text.innerText.
Wrap the text Store in double quotes within your text.innerText line.
oh wow lol I just realized I was on the wrong line of code the whole time. Honestly my apologies to you guys. I totally forgot I had text.innerText As soon as I saw the first store word I was a man on a mission & forgot about everything else. Thank you though
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.
The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.