Using JavaScript in Max

The js object allows you to use JavaScript in Max.

You can learn a few of the basics of implementing JavaScript programs within Max by studying this set of three small JavaScript programs. Download and save the six files found in that directory. The files are meant to be studied in progressive order: 1) bang2x.maxpat, 2) number1x.maxpat, 3) numbearray.maxpat. Within each patch, double-click on the js object to open the script it contains.

You can look up details of the core JavaScript language in the official JavaScript reference manual. You can read about Max-specific aspects of JavaScript in the JavaScript documentation found in the Max application’s Reference manual, which you can also read in the online version. In that documentation, most of the vital introductory information is contained in the chapters titled Introduction, and Basic Techniques.