isArray() not working in if statement (Steamroller)

Working on the steamroller problem (; my code is below, issue is with the if statement.

function steamrollArray(arr) {
  // I'm a steamroller, baby
  let flattened = [];

  for (var i = 0; i< arr.length; i++) {
    console.log("is position "+i+" an array? "+Array.isArray(arr[i]));
  } if (Array.isArray(arr[i]) == true) {
    console.log("entering recursion");
    }  else  {
  return flattened;

However, I never see any recursion and the console never logs “entering recursion.” (This also happens even if I remove == true from the if statement, not that that should make a difference in this context.) Can anyone explain why that is not working please? Thanks.

You seem to have closed your for loop prematurely. Look where you placed the }.

Also, keep in mind when you call steamrollArray inside the function, flattened will always starts as an empty array, so this will cause you trouble.

Derp on my part on the }, thank you. And also thanks for pointing out the next issue I need to fix in advance.