When I load https://meta.wikimedia.org/w/index.php?title=User:Fomafix/global.js&action=edit and fill in
console.log( "foobar" );
and click on Preview then I see foobar in the JavaScript console.
But when I fill in
console.log( "foo&bar" );
and click on Preview then I see the error message
SyntaxError: expected expression, got '}'
and all JavaScript of the UI is missing.