Steamroller challange

This is the Steamroller challange problem solution. Every time answer is showing correct but FCC doesn’t take it. What is the reason?

**The Code is:

function steamrollArray(arr) {
  // I'm a steamroller, baby
  return newArr;

function flattenArr(val) {
  for (var i = 0; i < val.length; i++) {
    if (!Array.isArray(val[i])) {
    else {

var newArr = [];

steamrollArray([[["a"]], [["b"]]]);

* browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36```.

**Link to the challenge:**

You are using a global declaration for your newArr variable, which is causing your problem.

Move the var newArr = []; into your steamrollArray function. You will then need to pass it to your flattenArr function each time you call flattenArr, so you will need a second parameter for your flattenArr function.

1 Like

Thank you. It works :smiley:

For an extra challenge, see if you can only use one function instead of the two.