I am having trouble with question 69 in the Javascript Algorithms and data structures.
Can someone please help with this?
Thanks in advance
Your code so far
const character = "#";
const count = 8;
const rows = [];
// User Editable Region
function padRow(rowNumber, rowCount) {
return " " + character.repeat(rowNumber) + " ";
}
character.repeat(rowCount-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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 69
You need to follow the instructions strictly. Don’t try rendom things when you working on the curriculum challenges. You need to add rowCount - rowNumber within repeat method for both blank strings.
Your last line of code above is correct. But you need to do it exactly for existing blank strings you have above that last line within the function body. Reset the challenge step and try again.
Above is the starting code for that challenge step. You have two blank strings " " within that code. Now you need to add .repeat() with rowCount - rowNumber times to that both blank space strings.
Pkdvalis I need to move passed question 69 in the javascript algorithms and data structures, just go the question and there are instructions which I dont get
you need a number of spaces in the string that is determined programmatically, repeat helps with that as it repeats the string the given number of times.
So, " ".repeat(5) means:
" "
instead of 5, you need to use the operation you are asked to use, that will result to a different value based on various things
You have written the expression to repeat the space, now you need to put it inside the return statement
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.