Client-side scripts should be written when a developer wants to change the screen in front of the user. This could be a change to a field value, visibility, or another change. Every time client-side scripts are run, it requires resources from the instance, and so keeping client-side scripting to a minimum is important.
If you can make a change on the server side rather than the client side, then is it considered best practice to do so. This will then keep loading times shorter and improve the user experience.
Let's have a look at some common uses for client-side scripting and how best to achieve these tasks.