WebScript must be used when you have to extend the Alfresco RESTful API to add your own REST API. This means that you have external HTTP requests that must exchange information with the repository. We can say that using WebScript you have an external system that must talk with Alfresco with a specific REST API.
Notice that you can implement WebScripts in two different ways: using the JavaScript API of the Java API of Alfresco, it depends on your specific needs. This because the Alfresco JavaScript API exposes just a subgroup of all the features offered by the Java API.
The JavaScript scripts allow you to execute actions or rules against the repository contents and these features can be triggered inside the repository moving, deleting or creating new contents. We can say that you have to implement business rules that will live inside the repository without external input.