4 ms·
For mapping from one value to another, sure. My irk with this solution is that none of their "object" solutions actually does the same thing as the switch state
by yoz-y 8y ago
For mapping from one value to another, sure. My irk with this solution is that none of their "object" solutions actually does the same thing as the switch statement, namely logging the state in various manners to console.
Now, they could, of course, do it using the function method, but they did not. If the functional code had logs in them it would become quite apparent that a bunch of if-else statements would probably do the job better.