Question d’entretien chez Equinix

Basic JS question, hard LC problem