Steamroller: code doesn't work in FCC

Please, explain me, why my code does not work? Note: it works as expected in repl.it, but in FCC passes only the first test. Many thanks in advance.

function steamrollArray(arr) {
  let flatter = new String(arr)
    .split(',')
    .filter(Boolean)
    .map(x => {
      if (x === '[object Object]'){
	    return {};
      }else{
	    return x;
      }
  });
  return flatter;
}

The reason that you are only passing the first test is because the first test is the only one that uses al all-string array. Because you are casting the array to a string and then splitting that string back into an array, you can only return an array of all strings. Your logic also would fail if any tests contained non-empty objects.

“Your logic also would fail if any tests contained non-empty objects.” - Actually, it doesn’t. Look.

That array doesn’t contain any non-empty objects. The original array contains numbers (and arrays of numbers). Your result contains strings.

Ok, I got it.Thanks.