My code seems to be generating the right output but it's not passing the tests
Challenge http://freecodecamp.com/challenges/bonfire-steamroller has an issue. Please describe how to reproduce it, and include links to screenshots if possible.
Code:
var arr1 = []; function steamroller(arr) { // I'm a steamroller, baby for (var i = 0; i < arr.length; i++) { if (Array.isArray(arr[i])) { steamroller(arr[i]); } else { arr1.push(arr[i]); } } return arr1; }
steamroller([1, [2], [3, [[4]]]]);
@diegomm77 right now there is a problem with your code. When you declare var arr1 = []; outside of your function it doesn't get reset each time a test is run. You can see this if you look at the results of your first failed test. Your current code returns [ 1, 2, 3, 4, 'a', 'b' ] instead of [ 'a', 'b' ]. Once you figure out how to solve this issue you will pass the challenge.
@catapixel Thank you sir.