Question d’entretien chez Sulopa Solutions

they ask me to solve the problem on JavaScript