Is fcc website bugged?

hello im going through javascript course and im trying to solve the steamroller exercise, this is my solution but when i paste it in the javascript code section it doesnt work. I have already tested it in the browsers console:

function steamrollArray(arr, eArray) {
    if (arr.length == undefined) {
        return eArray;
}
    let farray = [].concat(...arr);
    for (let i=0; i<farray.length; i++) {
        if (farray[i].length == undefined /*&& Number.isInteger(farray[i])*/ || typeof farray[i] == "string") {
            eArray.push(farray[i])
        } else {
            steamrollArray(farray[i], eArray);
        }
    }
    console.log(eArray)
    return eArray;
}

steamrollArray([1, { }, [3, [[4]]]],  [ ])

You changed the function signature. When you change the function signature, you break the test suite.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

oh i see thanks. Then how do i pass the test? do i have to como up with another code??

function steamrollArray(arr) {

Your function needs to use this signature. You can use the idea you have if you use the return value of your recursive call.

ok ill give it another try thanks.

1 Like