Fabrizio Caldarelli’s solution works well if your IDE supports Javascript code completion / highlighting in PHP heredoc string literals. Otherwise use registerJs only for small snippets that doesn’t really require code completion and for longer Javascript parts there are a few alternatives:
[list=1][]Store them in a separate file.[]Use beginBlock() / endBlock().[*]Simply use <script> tags. Requires all dependencies (Jquery, etc.) to be loaded in the <head> of the page which impacts negatively on page loading time, but acceptable for applications relying heavily on Javascript / AJAX.[/list]