Pregunta de entrevista de Tinder

How can you solve this javascript class problem