As we have seen, client scripts run on the client side and so only have access to data that has been sent to the client from the server. The main goal we have when writing client-side scripts is to minimize the amount of script we write and the calls to the server we make.
The reason we keep client scripting to a minimum is that these scripts run in front of the user and therefore directly effect loading times. We want to keep loading times to a minimum and, therefore, client scripting to a minimum also.
When writing a new client script, it is worth considering whether the script could be run on the server side instead, and if so, then this is usually considered a best practice.
Let's have a look at one of the ...