The methods available in client-side scripting expect valid parameters. You must check the parameters before calling the methods. If an invalid parameter is passed in, an exception occurs, in which case your code must handle the exception.