Need help with this step

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

const myStr = ""; 
var myStr = "This is the start." + "This is the start.";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Concatenating Strings with Plus Operator

Link to the challenge:

there should be a comment asking you to change a specific line

const myStr = ""; // Change this line

When you started the step, was the comment there?

I believe the second line is correct. However, the top line is what they initially gave me, perhaps indicating that I should fill in the quotations.

Not quite sure what to do .

Yes. That comment was there.

yeab, you got the correct idea, but created another variable with the same name.

The test, which is testing the original variable, is ignoring the new one

I tried deleting the top line, but that did not work.

What do I do?

Change the type of the second variable from var, to read only type

var myStr

Edit: you can click Restart The Step button, and change the value inside the quotations

I don’t know how to do that . I think I need an additional study guide. I don’t understand read only type.

Do you remember the sections on how to declare variables, with the key words var, let and const? Look them up and see which one looks like it would be for a read only variable.

@Mgio

read-only var is const, it’s read-only because when you assign its value, it can’t be changed, and it can be read only

When you use var for this challenge, notice that failed test say to use const

image

when you are using "This is the start." + "This is the end.", notices that what you are providing This is the start.This is the end., isn’t what is required This is the start. This is the end., so the first test fall, as well.

image

So, don’t use var myStr and only change the value of const myStr while accounting for spaces

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.