How to embed javascript into an application

The easiest way is to put your javascript code into an html file, then change the extension of this html file to hta (such as xxx.hta), and then double-click this file to run it directly. HTA means HTML application, so it is essentially an application similar to exe.