Tell us what’s happening:
When I run the tests I get errors for the output, but I fail to see how my output is any different than the expected output… I feel it has to do with some spacing issues but I have no idea. I assumed using another function was not forbidden, tho that might be the issue as well.
Your code so far
function printSymbol(num, symbol) {
let output = "";
for (let i = 0; i < num; i++) {
output += symbol;
}
return output;
}
function pyramid(pattern, num, isUpside) {
let output = "\n";
if (isUpside) {
for (let i = num; i > 0; i--) {
output += (" ".repeat(num - i));
output += printSymbol((i * 2 - 1), pattern);
console.log(output);
output = "";
}
}
else {
for (let i = 1; i <= num; i++) {
output += (" ".repeat(num - i));
output += printSymbol((i * 2 - 1), pattern);
console.log(output);
output = "";
}
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
Challenge Information:
Build a Pyramid Generator - Build a Pyramid Generator
https://www.freecodecamp.org/learn/full-stack-developer/lab-pyramid-generator/lab-pyramid-generator