Listing of supported Math functions in Javascript


    Norman Freund's icon
    Norman Freund's icon
    Norman Freund
    Mar 30 2023 | 6:12 am
    Is there a means of obtaining the full list of functions, i.e. the xxx's supported in Javascript for Max? Looking that the Max reference manual, they quickly point you in the direction of the reference manual, ok great but not all the functions for Math are supported by Max (one example the Math.trunc() function). Hoping there is a reference manual for this or something like sending an info message to Max objects to list what goodies they have.

    • Jan's icon
      Jan's icon
      Mar 30 2023 | 4:12 pm
      The JavaScript implementation in Max is ECMAScript 6 - so a version from 2015 I believe. All Math object function supported in ECMAScript 6 should work in Max as well.
    • Norman Freund's icon
      Norman Freund's icon
      Norman Freund
      Mar 31 2023 | 6:46 am
      Thanks Jan, so I do a search for a reference manual of Javascript 6 (ECMAScript 6) and find this:
      which lists the Math.trunc() as a valid built in function, however Max (8.5.3) does not support it. For example this simple code of: function doit(hi) { post(Math.trunc(12.3)); }
      when sent the message of: doit 1
      yields the following error: js: NOF_NxNR_js2.js: Javascript TypeError: Math.trunc is not a function, line 4 js: error calling function doit [NOF_NxNR_js2.js]
      Indicatng the Math.trunc is not supported.
      So perhaps Max developers decided to pick and choose which built-in functions to implement? (a bit of sarcasm ;) .
      Yes I remember reading somewhere else that Max is supporting version 6 of Javascript.
      So the original question still holds, what source of information are developers to use to program in javascript in the Max environment, not the Max/Live specific methods/properties (this is well documented in the Max reference manual) but the javascript language implementation.
      So far the only method I have is to look at say: pick a function I would like to use and cross my fingers that Max supports it.
    • Rob Ramirez's icon
      Rob Ramirez's icon
      Rob Ramirez
      Mar 31 2023 | 11:27 am
      the js object in Max is es5. for modern js you have 3 options: jweb, node-for-max, or transpilation (possible workflow can be found here - )
    • Norman Freund's icon
      Norman Freund's icon
      Norman Freund
      Mar 31 2023 | 10:12 pm
      Thanks Rob, Found the official ECMA Script 5 here: and confirms that for instance the Math.trunc() function does not exist. So this is perfect, documents the Javascript used in Max 8.5.3. I have not dived too deeply in to the js object, so the version 5 will do nicely for the moment. Thanks for your help.