posted 12 years ago
You can do with it whatever you want to do with it. For example, you can integrate a scripting engine into your own application to make it possible for users to automate things in your application.
Last year I worked on a project where we wrote a piece of software that does price calculations (batch processing: it reads transactions from a file, and then calculates the price of each, according to business rules). We needed to have a way to be able to change things in the business rules easily, without needing to create a new version of the application each time a business rule changes. So we added the possibility to implement business rules in JavaScript; our application uses the JVM scripting engine to execute those scripts.
JavaScript is also sometimes used on the server side in web applications (have a look at Node.js, for example, which allows you to build webapps in JavaScript - although Node.js does not run on the JVM).