Tell us what’s happening:
Hello,
My code solution is working and returns the correct output, however it doesn’t pass the lab tests.
Perhaps this is a bug?
Your code so far
let pyramid = (str, int, bool) => {
let pString = "";
if(bool) {
let v = int*2-1
for(let i=0; i<int; i++) {
pString += " ".repeat(i) + str.repeat(v) + "\n"
v-=2;
}
} else {
let v = 1
for(let i=int; i>0; i--) {
pString += " ".repeat(i) + str.repeat(v) + "\n"
v+=2;
}
}
return pString;
}
console.log(pyramid("o", 4, false))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Pyramid Generator - Build a Pyramid Generator