I wouldn’t call it modern JS (btw this thing existed I think 10 years ago, called Object literals), also it’s worse & they are totally different things:
The OP uses switch case which is perfect for this case, since JS will create a jump table which has better performance.
But yours will create object everytime repeatedly.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I wouldn’t call it modern JS (btw this thing existed I think 10 years ago, called Object literals), also it’s worse & they are totally different things:
The OP uses switch case which is perfect for this case, since JS will create a jump table which has better performance.
But yours will create object everytime repeatedly.