I think to make sure all parameters are there you can throw a error if one of the mandatory parameters or values are not met.
The web debugger should do this for us (the Console should print out getX not defined) and there's no point duplicating this function as I would need to scan the entire JS code of the web content to search whether a function is called or not).