Why is my code not working, I declared a variable and assigned the padRoe call.
Your code so far
const character = "#";
const count = 8;
const rows = [];
function padRow() {
}
// User Editable Region
const padRows = padRow();
// User Editable Region
for (let i = 0; i < count; i = i + 1) {
rows.push(character.repeat(i + 1))
}
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
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/131.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 49
You’ve created a function padRow. What is it doing?
You’re then calling padRow() and assigning the return value to the constant padRows. What value is getting assigned to padRows and what is padRows then being used for?
It helps to look through your code line by line and ask what each thing is doing.
Thanks for the heads-up. I’m new here, so I’m still trying to figure out some of the nuances. I did look at the link provided for #49, and it says:
Step 49
You are calling your padRow function, but not doing anything with that function call. All functions in JavaScript return a value, meaning they provide the defined result of calling them for you to use elsewhere.
My reply was very much on point with this message. I’m not sure what I’m missing here.
You are calling your padRow function, but not doing anything with that function call. All functions in JavaScript return a value…
I took that to mean, you must do something with the function.
So, with that in mind, my comment helps with what I thought the issue was. The issue (I thought) being that the function was not doing anything.
I have since realized that I was mistaken as to what the issue actually was, as
PauloRodrigues already pointed that out to me, and I acknowledged his comment.
There was no need for further digging into my misinformed response, but I’m happy to explain myself. Hopefully that clears up any confusion.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.