if (!Array.isArray(array) || !array.length) {
  // array does not exist, is not an array, or is empty
  // ⇒ do not attempt to process array
}

or 

if (!array?.length) {
    // array or array.length are falsy
    // ⇒ do not attempt to process array
}