Invert an Object
Medium · Objects
Write a function invert that swaps the keys and values of an object: every value becomes a key, and its key becomes the value.
If two keys share the same value, the key that comes later in the object wins.
Next: camelCase to snake_case