• Returns the first not empty element in the given array, or null if all elements are nil

    Parameters

    • Optionalarray: null | any[] | readonly any[]

      the array to check

    Returns any

    the first not empty element in the given array, or null if all elements are nil

    firstNotEmpty([null, undefined, {}, 'foo', 'bar']);    // 'foo'