You need to do the same thing on the client and the server.
- DOM manipulation for AJAX states so they can be reached directly from the server without needing client side JS to do anything
- Calculate discounts for products (obviously clients just POST the product they want, but the discounts should be applied on the server consistently to how they were shown to the user)
- Your code is something generic, like recursively checking for a keypath on an object, and totally useful for JS anywhere it runs.
All kinds of other reasons.
I found it rather pleasant to have the same libs on client and server. Learn one lib API and use it everywhere :)
It also enabled me to move functionality freely around.
Calculating report data on the front-end, so it gets ready tomorrow and later moving it into the back-end, for performance reasons.
What would be the reason to do that?