Steamroller, code not passing any tests

Tell us what’s happening:
Hey everyone! My code works for me, and it’s logging the proper thing to the console too, however it’s not passing any of the FCC tests, I wonder what I’m doing wrong?
Thanks a lot in advance!

Your code so far

function nest(el) {
	if (!Array.isArray(el)) {
		return el;
	return nest(el[0]);

let newArr = [];

function steamrollArray(arr) {
  arr.forEach( (el) => {
	  if (!Array.isArray(el)) { 
	  else {
		  el.forEach(el => { 
  return newArr;

steamrollArray([1, [2], [3, [[4]]]]);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/75.0.3770.90 Chrome/75.0.3770.90 Safari/537.36.

Link to the challenge:

Your code contains global variables that are changed each time the function is run. This means that after each test completes, subsequent tests start with the previous value. To fix this, make sure your function doesn’t change any global variables, and declare/assign variables within the function if they need to be changed.


var myGlobal = [1];
function returnGlobal(arg) {
  return myGlobal;
} // unreliable - array gets longer each time the function is run

function returnLocal(arg) {
  var myLocal = [1];
  return myLocal;
} // reliable - always returns an array of length 2