Tell us what’s happening:
How best to improve my programming skills this calling function is annoyingPreformatted text
?
Your code so far
const character = "#";
const count = 8;
const rows = [];
function padRow(rowNumber, rowCount) {
return character.repeat(rowNumber);
}
// User Editable Region
for (let i = 0; i < count; i = i + 1) {
padRow(.push);
}
// User Editable Region
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/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 66
Hello!
This step is asking us to replace
the character.repeat(i +1) within the rows.push() function
with the padRow()
function.
Reset it and only replace the character.repeat(i + 1)
with padRow()
I hope this will help.
5 Likes
rows.push(padRow)Preformatted text
How do you separate functions from calls, please show me examples of correct solutions, i.e. Hello(), how do you action a padRow function here?
Hello!
It is good except the () need to be added after the padRow() within the rows.push(here) function.
Example: carBattery.push(checkIt());
(mine always died in the winter)
rows.push(function) within this function we call another function. Functions always have () after the main name. In this case the function we are calling is the padRow() function.
2 Likes
I need to get to grips with calling, padRow.push() . Where do you learn all these things?
How do you know these strings?
Hello!
I learned it from the instructions.
Step 66
A function call allows you to actually use a function.
You may not have been aware of it, but the methods like .push()
that you have been using have been function calls.
A function is called
by referencing the function's name
, and adding ().
Here’s how to call a test function:
test();
Replace the character.repeat(i + 1)
in your .push() call with a function call for your padRow
function."
I hope this helps you, along with my previous posts.
What we are doing is placing a function padRow() within a function rows.push() function to call it.
1 Like
you can see the correct solution on next step if you want. but that way you did not remember the code and you will stuck again and again. you need to learn coding here, not copy pasting.
1 Like