Tinder Interview Question

How can you solve this javascript class problem