Freecodecamp: Concatenating Strings with Plus Sign solution not working

Created on 26 Mar 2020  路  13Comments  路  Source: freeCodeCamp/freeCodeCamp

Describe your problem and how to reproduce it:
As described in the linked forum posts, the correct solution is not passing one of the test.
1) Go to lesson
2) Paste in correct solution: var myStr = "This is the start. " + "This is the end.";
3) See test fail

Add a Link to the page with the problem:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator

  • Browser Name: Chrome
  • Browser Version: 80.0.3987.149
  • Operating System: Windows 10

Linked Forum Posts:
https://www.freecodecamp.org/forum/t/bug-javascript-concatenation/363779
https://www.freecodecamp.org/forum/t/concatenating-strings-with-plus-operator-bug/363780

learn

Most helpful comment

Update: There were only 42 files on that PR and only a few of the challenges were affected. Almost finished with the PR that will fix this mess. I also changed some of the tests to make them more robust at the same time.

All 13 comments

Upon testing: Posting in this solution works, but only because of the added variable:

var ourStr = "I come first. " + "I come second.";
var myStr = "This is the start. " + "This is the end.";

You can pass the challenge with this:

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

I didn't test this but the seed code was changed (moved to challenge text) so now the solution code doesn't match.

Code changes:
https://github.com/freeCodeCamp/freeCodeCamp/commit/e0e633462807b69e08dfb5cc7171fcc9294b613f#diff-1b554bd4d9d3d478b0cf24500394c8cd
https://github.com/freeCodeCamp/freeCodeCamp/commit/e0e633462807b69e08dfb5cc7171fcc9294b613f#diff-076de93d4dcbbbf202da03cedb3e8482

Here's the file with the problem.

The second test needs to be changed to either check === 1 instead of > 1 or I would rather it use the .test method and remove the comparison - and the first line of the solution needs to be removed.

Yep, I saw that. I was trying to figure out Gitpod so I didn't post back. Still not 100% sure of the workflow.

But it's an easy enough fix so I think maybe we should let someone new get a commit in.

But it's an easy enough fix so I think maybe we should let someone new get a commit in.

Let's not leave it too long, it'll be frustrating for people trying to learn.

This challenge is affected as well I'm guessing
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator

testString: assert(code.match(/\w\s*\+=\s*["']/g).length > 1 && code.match(/\w\s*\=\s*["']/g).length > 1);

Edit: should we open an issue for that one as well?

Due to the PR merged yesterday, there are several challenges that I am fixing right now that were using the match.length > 1. The reason the tests did not break, is because the solutions still had the example code that was removed from the challenge seed of the challenges. If there are any others like this particular challenge, please post here and I will fix them all in a single PR this morning, so we can get it merged ASAP.

Update: There were only 42 files on that PR and only a few of the challenges were affected. Almost finished with the PR that will fix this mess. I also changed some of the tests to make them more robust at the same time.

@lasjorg I modified all of those and a few more. The comments should not make any difference. We had planned on removing the comments from the solutions at one point during this whole process, but we concluded a separate PR after all of set of 4 PR which consolidated comments in the JavaScript challenges would be better. We can do that once we have validated my latest PR fixes the latest bugs.

Do we need a temporary pinned forum message just to acknowledge the bugs and avoid a flood of posts?

My goal is to get PR #38450 merged in the next 30 minutes and then ask @raisedadead to deploy to production as soon as possible. @raisedadead Should we create a pinned message or just get PR #38450 merged and deployed to production?

@Sky020 @lasjorg Please feel free to review PR #38450.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DaphnisM picture DaphnisM  路  3Comments

QuincyLarson picture QuincyLarson  路  3Comments

EthanDavis picture EthanDavis  路  3Comments

raisedadead picture raisedadead  路  3Comments

robwelan picture robwelan  路  3Comments