If seen was not given, let seen be a new empty set. If input is in seen return invalid. Jump to the appropriate step below: If (input) is Number If input is NaN then return invalid. Otherwise, return a new key with number and value input. For example, the value [10, 20, null, 30, 20] is converted to an with subkeys 10, 20, 30.