Tell us what’s happening:
cannot get step three to return anything. what am I missing in the code?
Your code so far
function pyramid(char, count, inverted) {
const rows = [];
for (let i = 1; i <= char; i++) {
const row = ' '.repeat(count - i) +
char.repeat(2 * i - 1) + ' '.repeat(count - 1);
if (inverted) {
count.unshift(row)
} else {
count.push(row)
}
}
return rows.join('\n')
}
const result = pyramid( "o", 4, false);
console.log(result);
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