Using an object as a mapping mechanism is an smart approach that I use often. Tends to simplify the code a lot. Some coworkers got amazed how I converted they huge switch statement into a simple object lookup. If you are teaching this to your students, then god bless you, we really need better devs on JS community.
PS: Technically we are using the object in a way that is very close to the switch statement, but given the exercise requirements it is totally correct :D