Tell us what’s happening:
Please help, I got the results but still not passing.
Your code so far
function pyramid(str,num,bolean)
{
let result = "\\n";
if(bolean==false)
{
for(let i=1; i<=num; i++)
{
let space=" ".repeat(num-i);
let pattern=str.repeat(2*i-1)+"\\n";
result=result+space+pattern;
} console.log(result);
}
else {
for(let j=num; j>=1; j--)
{
let space=" ".repeat(num-j);
let pattern= str.repeat(2*j-1)+"\\n";
result=result+space+pattern;
} console.log(result);
}
return result;
}
pyramid("o", 4, false);
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 Edg/145.0.0.0
Challenge Information:
Build a Pyramid Generator - Build a Pyramid Generator