Here is a file which is valid both as html and javascript.

source (see html source for the detail)

You can use such a file to write a document and also test code in the javascript. Test code is not executed when you include js with script src=.
/