Build a Pyramid Generator - Build a Pyramid Generator

Tell us what’s happening:

Is there an error in the solution check?

I fail at test 3 & 4, but my results are exactly like requested. I know, that the “build a pyramide generator” was a workshop before the FCC-restructuring and now it’s a lab. Before, they worked with arrays, but now i worked with strings only. Am I missing something or does the solution-checker needs to be adjusted?

Your code so far

function pyramid (symbol, rows, downwards) {
    let linebreak = "\n"
    let result = linebreak
    if (!downwards) {
        for (let i = 1; i <= rows; i++) {
            for (let left = 0; left < (rows - i); left++) {
                result += " ";
            }
            for (let mid = 0; mid < ((i * 2) - 1); mid++ ) {
                result += symbol;
            }
            result += linebreak;    
        }
    } else {
        for (let i = rows; i >= 1; i--) {
            for (let left = 0; left < (rows - i); left++) {
                result += " ";
            }
            for (let mid = 0; mid < ((i * 2) - 1); mid++ ) {
                result += symbol;
            }
            result += linebreak;   
        }
    }
    console.log(result);
}


pyramid("p", 5, true)

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0

Challenge Information:

Build a Pyramid Generator - Build a Pyramid Generator

Okay, sorry. I had to return the result, but I just logged it in the console!