anyone can help me i got stucked to concatenated this thing
the question :
You should now see the same bunch of characters in your console. Your padRow function is doing the exact same thing you were doing earlier, but now it’s in a reusable section of its own.
Use the addition operator to concatenate a single space " " to the beginning and end of your repeated character string.
Remember that you can use the + operator to concatenate strings like this:
Example Code
" " + "string"
Check Your Code (Ctrl + Enter)
Sorry, your code does not pass. Don’t give up.
You should concatenate a single space to the beginning of your returned value.
ResetHelp
// running tests You should concatenate a single space to the beginning of your returned value. You should concatenate a single space to the end of your returned value. Your
padRow()
function should return the repeated
character
series with a space before and after the series. // tests completed // console output # ## ### #### ##### ###### ####### ########
Navigated to Step 67
Your code so far
const character = "#";
const count = 8;
const rows = [];
// User Editable Region
function padRow(rowNumber, rowCount) {
return character.repeat(rowNumber);
}
// User Editable Region
for (let i = 0; i < count; i = i + 1) {
rows.push(padRow(i + 1, count));
}
let result = ""
for (const row of rows) {
result = result + "\n" + row;
}
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 67
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.
The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
exactly that’s why i asked bout it, i mean if there any hint for me or smth that could help me , im sorry if i just give up rn cuz its my first time to learn javascript …
Hi there and welcome to our community @harsh1720. Please refrain from posting solutions on the forum. We are here to offer guidance and hints to allow campers to find the solutions themselves.
This step is asking us to concatenate the " " single space to both before and after the return character string.
In the example the “string” would be the current return value in our code with not any “” around it.
" " + "string"
See how the single space " " + has been added before the “string” in the example.
This is how we add it before the character.repeat(rowNumber).
Then, we use the + and the single space " " string after it as well.
Remember to leave a space between the " " marks.
I hope this helps to understand it better. I found this a bit confusing myself when I completed this step.
The hint that this step gives is not the most informative.
It is asking you to put a single space like this " " before and after your character.repeat(rowNumber) not to add spaces into the command, this makes it so that a single space is shown before and after each repeating character (#)
!!Adding a space into the existing return command will not work i.e
character.repeat(" " + rowNumber + " ") does not work!!
Second hint is "string "= character.repeat(rowNumber);