Function draw

Draw a random item from a list. Returns null if the list is empty

const fish = ['marlin', 'bass', 'trout']

draw(fish) // => a random fish
  • Type Parameters

    • T

    Parameters

    • array: readonly T[]

    Returns null | T