The reason people do it is to prevent wikitext found within the Javascript code from affecting Special pages' output, is my understanding.
Like, if I have some complicated script in my global.js that happens to involve a link to the template "Foo", then the code {{Foo}}
will then appear on the global.js page. It doesn't actually display as a template because Javascript pages are displayed as Javascript, but if there's no pre/nowiki/syntaxhighlight, then "Foo" is listed on Special:WantedTemplates because the Javascript page links to it.
I for one wish it were a more common tactic to use those limiting tags. For an example, check out Special:WhatLinksHere/Template:Trolling. The template doesn't exist, and never has, but a few users' Javascript pages are causing it to display as a wanted template.