Function flatten

  • Flatten nested arrays.

    Create array with same elements as in input array where all elements which are also arrays are replaced with elements of resulting recursive application of flatten function.

    If argument is not an array, function returns the argument encapsulated in an array.


    • arr: any

    Returns any[]