freeCodeCamp icon indicating copy to clipboard operation
freeCodeCamp copied to clipboard

Pyramid Generator - Step 43: Change example to concatenate a new line

Open dinahess opened this issue 9 months ago • 2 comments

Describe the Issue

In Step 43 of the Pyramid Generator app in the JavaScript Algorithms and Data Structures curriculum, the example to concatenate a new line could be confusing to students.

Affected Page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-introductory-javascript-by-building-a-pyramid-generator/step-43

Steps to Reproduce

Navigate to Step 43 of the Pyramid Generator project and note that the example shows students how to concatenate a new line between two variables. But the instructions want the student to concatenate a new line after the concatenation of two variables.

Recommended fix or suggestions

Change the example from:

lineOne = lineOne + "\n" + lineTwo;

to:

lineOne = lineOne + lineTwo + "\n";

Screenshots

No response

dinahess avatar Mar 08 '25 13:03 dinahess

I understand the reasoning, but the example and what is needed in the code are not the exact same thing

If you have code for one line (lineOne) and code for an other line (lineTwo), you need to put the newline character between them, or they will not be on two different lines

Maybe the example need to be changed some more

majestic-owl448 avatar Mar 08 '25 17:03 majestic-owl448

I've seen more than one student get tripped up on this step in the Forum, and since Pyramid Generator is the first JavaScript project they are attempting, it seems best to provide examples that are very similar to what the instructions are asking them to do.

dinahess avatar Mar 08 '25 19:03 dinahess

In reality the instructions are very clear about what needs to be done:

Use a second addition operator to append a new line after the result and row values.

An example should be an example, not the answer. We want campers to develop critical thinking, not copy and paste skills. It's a really important part of programming.

Please, if you think this issue is closed by mistake, make sure to re-open so we can discuss this further.

Sembauke avatar Mar 18 '25 08:03 Sembauke