const labels: string[] = ["Bean", "Pea"]; const chosen = labels[3]; console.log(chosen === undefined ? "No label at that position" : chosen);