Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, May 15, 2017

FreeCodeCamp Steamroller Sample Solution



function steamrollArray(arr) {
  // I'm a steamroller, baby
  var flattened = arr.reduce(
    function(a, b) {
      return a.concat(Array.isArray(b) ? steamrollArray(b) : b);
    },[]);
  return flattened;
}

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

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts