Where should we write a escript and how can we run browser script before we compile it?

After writing escript how to run it through browser script and server script explain both in detail
...