This method should only be used if the varaibles would determine what JavaScript code was loaded (e.g., with the request being processed by PHP, dynamically building the JS file).
If you want to pass information to JavaScript code, use functions or variables in the code after it is loaded.