Challenge Waypoint: Concatenating Strings with Plus Operator has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// Example
var ourStr = "I come first. " + "I come second.";
// Only change code below this line
var myStr = "This is the start." + " This is the end.";
Fails the second test even though it is correctly using the + operate as far as I can see.
It's testing for a space at end of "This is the start."
instead of testing the end result for a space.
var myStr = "This is the start." + " This is the end.";
Should be
var myStr = "This is the start. " + "This is the end.";
It's easily missed unless you pay close attention to the strings given to you in the instructions.
If that passes great, but the end result string was already passing the test. It was the second test "use the + operator to concatenate the strings" that was failing. Will close, but I still think it might need some work.
I works only with single quotes i found !!
Yeah, it works only with single quotes!
I had the correct answer and it was failing the same test "use the + operator to concatenate the strings" (Yes, I had the spaces in the correct place). The issue was resolved when I extended the var myStr;
instead of leaving var myStr;
and adding myStr = [code];
on a new line.
I prefer to only write new code and avoid editing existing code when I can help it. If you want people to edit existing variables then it might be worth explicitly stating that (especially if it will cause the test to fail for an incorrect reason), alternatively improve the error testing so we know exactly what's wrong. It's quite frustrating to have the correct answer but be stuck for five minutes trying to figure multiple ways of getting it to pass until you strike gold.
Edit: I got mine to pass with double quotes, for the record.
I still don't see the point of the instructions adding space between the period and the double quotes, it looks weird having the double quotes in the middle.
Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.
I fell for it "twice". Then finally realized..
// Crazy little detail with the spacing regarding the quotation marks in the concatenated second sentence
Most helpful comment
It's testing for a space at end of
"This is the start."
instead of testing the end result for a space.Should be
It's easily missed unless you pay close attention to the strings given to you in the instructions.