The packing algorithm is forgiving of all forms of JavaScript with one exception. You must correctly terminate all JavaScript statements with semi-colons. This includes function expressions.
Here is an example of correct, semi-colon terminated JavaScript:
// sample code
var input, output;
// notice the semi-colon at the END of function expressions
onload = function() {
input = document.getElementById("input");
output = document.getElementById("output");
clearAll(true);
};
function packScript() {
output.value = pack(input.value);
}
function clearAll(focus) {
output.value = input.value = "";
// the "if" statement is NOT terminated with a semi-colon
if (focus) {
input.focus();
}
}