Is there a bug, or am I the bug?

Tell us what’s happening:
Is there a bug with the system? I get a message stating that freeCodeCamp will be notified. Or is my code messed up? I am stuck here.

Your code so far


// Only change code below this line
var myName; = "Derik"; 
var myStr; = "My name is " + myName + " and I am well!";

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15

Challenge: Constructing Strings with Variables

Link to the challenge:

Is there a bug, or am I the bug?

Sorry, in this case you are the bug. But if it makes you feel any better, if we had a penny for every time a developer said, “No, I made no mistakes, JavaScript must be broken…”, then we could afford to feed the hungry around the world,

The issue is for example:

var myName; = "Derik"; 

You have two semicolons here. Semicolons (at least these kind) should only go at the end of the lie - I don’t know what the one in the middle is doing.

When I remove the extra semicolons (on both lines) then the code passes for me.

2 Likes

Sounds good. I will make sure not to make this kind of mistake going forward. Now it says that myName should be a string at least 3 characters long. What am I am I not seeing here?

The value that myName holds should be a string with at least 3 characters. You are assigning it the value of “Derik” which has 5, so you’re fine. But someone named “Al” would run into trouble.

Or maybe I misunderstood. If you are still having issues, please show the code you have now…

// Only change code below this line

var myName; “Derik”;

var myStr; “My name is " + myName + " and I am swell!”;

It says I am missing the semicolon in the spots you said they weren’t needed.

You removed the equals signs (=) not the semicolons (;).

The basic format should be:

var myVar = "whatever value I want";

That equals sign should be there and the only semicolon should be at the end of the line.

1 Like

I’m just jumping in to say that your topic title gave me a good chuckle.

= is called the assignment operator. It means “Save the stuff on the right into the variable on the left.”
; works the way that a . does in a sentence. It breaks your code into discrete pieces of code that each run independently. It means “This command is done. On to the next.”

2 Likes