Tell us what’s happening:
The test says I am not completing points 3 and 4 but in the console I am returning the string they want me to return. I am completely lost and I am not seeing what the error is. Help
Your code so far
function pyramid (str, int, bool) {
let rowCount = "\n";
let result = "";
if (bool === false) {
for (let i = 1; i <= int; i++) {
result += rowCount + " ".repeat(int - i) + str.repeat(i * 2 - 1);
}
} else if (bool === true) {
for (let i = int; i >= 1; i--) {
result += rowCount + " ".repeat(int-i) + str.repeat(i * 2 - 1);
}
}
return result;
}
console.log(pyramid("o", 4, false));
console.log(pyramid("p", 5, true));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Challenge Information:
Build a Pyramid Generator - Build a Pyramid Generator