Any plans to update support for recent versions of JS?


    Feb 19 2016 | 8:01 am
    As it is now, Max supports javascript 1.6 which is known as ecmascript 3. Javascript is now, slowly moving into ecmascript 6 with increasing support from popular browsers. There are some sensible reasons we should all stop using js 1.6, one of which is that it no longer supports coding standards appropriate for javascript--the use of arguments.callee and arguments.caller are somewhat deprecated in ES5 for example and possibly removed from es6. Many new javascript developers are learning very new ways to write proper code with js especially with the introduction of classes and new features in es6. Is it time to update javascript in Max in order to keep up with a few new developments and new javascript programming standards? Eventually it will be awkward writing javascript in the "old fashioned" way in Max.

    • Andro's icon
      Feb 19 2016 | 5:44 pm
      A built in debugger, autofill and a library of very clear simple examples is all I'd like from Javascript in Max. After many failed attempts to use it I just kinda gave up on it a while ago. ( i still can't get an external editor to work with it) As I've stated before the tutorials go from 0 to a 100 at tut 2. In processing I learn new things all the time due to the feedback from the software. A new improved version ? Yes please :)
    • ak's icon
      ak's icon
      Feb 19 2016 | 6:01 pm
      I second that request. Eg. arrow function notation allows more concise functional programming, the heart of many algorithmic composition concepts. Not to mention generators and proper collection types.
    • estevancarlos's icon
      estevancarlos's icon
      Feb 19 2016 | 6:13 pm
      I just realized that the documentation in Max is out of date. It states JS is based on es3 but I tested an es5 array method and it works. Max's documentation is making me look kinda stupid.
      Anyway, I still think Max should keep it's eyes on es6 and I hope to see that support in a few years. It's not critical now. However in a few years it will be. They should also remove that whole callee/caller thing.
    • estevancarlos's icon
      estevancarlos's icon
      Feb 19 2016 | 6:21 pm
      @ANDRO Debugging in JS has, to my understanding, been messier than other languages. I think that's a challenge that will exist for some time. However there is a way to edit with an external editor but sometimes, from my experience, despite using autowatch = 1, you may sometimes need to close your patch and reload it in order to detect changes. I'm not sure what causes this.
      @AK Yeah, it's hard to dislike es6. I won't use the word "beautiful", I'll reserve that for Python, but es6 is inspiring. I just noticed how it fixes string interpolation.
      es6: 'a total of ${card.amount * card.unitprice} bucks?';
      es5 below: "a total of " + (card.amount * card.unitprice) + " bucks?";
      No extra quotes. Easier to read. Sooo refreshing.
    • jonah's icon
      jonah's icon
      Feb 20 2016 | 1:19 pm
      i was wondering if js engine as part of what's in jweb/chromium embed framework might be integrated more in the future? there are browser based code editors and the max 7 reference does some neat stuff with html/how it works with max patcher, drag n drop. plus web stuff in general has a wide variety of people working to make it faster, better for interface/presentation stuff. i guess google and mozilla are both doing stuff to turn js into asm?
      seems like both js, gen and a few other objects would work well with easier ways of feeding in html frontend for viewing/editing. then the language could be abstracted further. when doing code stuff i think it could be useful to think more in terms of 1 language. like in gen tag the 'js' with or something, then write in a more gen style, like when you want to do more macro data/procedural structure stuff where gen gets tricky and switching code syntax/ punctuation/grammar gets me making silly errors. i feel like js in max now is kinda divided in terms of if it's for patcher scripting or data manipulation. plus most of the time i'd rather think/work more max/msp/gen style :) prefer js for more meta stuff dealing with the patcher/layout in a programatic way.
      Max Patcher
      In Max, select New From Clipboard.
      Show Text
      interesting thing is that w/ jweb website data in get saved somewhere, at least temporarily, i can quit, re-open max and still see changes in web based editors. no ad block in max browser is not so good though. :)
    • Gert's icon
      Gert's icon
      May 24 2016 | 2:32 pm
      +1 would be great to have an idea about the roadmap here, I'd love to have access to the 'Set' and 'Map' objects of ES6 :)
    • knasterbugg's icon
      knasterbugg's icon
      Jul 28 2016 | 6:13 pm
      Javascript 1.6 was released over ten years ago! I work professionally with Javascript for both browsers and servers so opening up a Max patch and doing Javascript there feels like going back to the stoneage. It's such a shame and I really hope we can make a big leap towards a more modern Javascript environment!
      I think looking at V8 (the Javascript engine) to see how it can help would benefit enormously. It's the engine that runs javascript in Chrome browser, Node.js and MongoDB, so clear ly a trusted technology. Also, if V8 is used we get free upgrades by letting the V8 team implement upcoming Javascript features!
      Any core developers here to comment on this?
    • Joshua Kit Clayton's icon
      Joshua Kit Clayton's icon
      Joshua Kit Clayton
      Jul 28 2016 | 8:12 pm
      The implementation that integrates completely with Max is based on the spidermonkey engine (and specifically the jaegermonkey JIT compiling version) and corresponds to Mozilla's Javascript 1.8.5 (which is a relatively modern ES 5+ version). There are no plans to update this to more modern engines in the near future, as it represents a significant amount of engineering to do so.
      For those of you that wish to develop in ES6/2015 or make use of other modern language features, you have two paths:
      1. Make use of a transpiler like targeting ES 5 output. This is very common for web developers and there are a number of utilities like gulp and such to make your development more smooth to code and have it automatically transpile and update in the background: (I'm not an expert at JS toolchains, so please spend some more time googling around if these links aren't enough to point you towards an appropriate workflow).
      2. We do use the Chrome Embedded Framework for the implementation of jweb. And you can run javascript inside jweb and communicate back and forth to/from max (asynchronously as it runs in a separate process). This also gives you access to other web browser related extensions which are not in the core language such as DOM utilities, websockets, a more robust XMLHTTPRequest implementation, etc. It isn't going to have the kinds of patcher integration that we have with the integrated spidermonkey version, however. A really cool project which shows this in operation is this one that runs p5.js inside max, recently posted here:
      Hope this gives you a few options to explore.
    • Lee's icon
      Lee's icon
      Jul 28 2016 | 8:23 pm
      nice, thx for the info
    • nick rothwell | project cassiel's icon
      nick rothwell | project cassiel's icon
      nick rothwell | project cassiel
      Aug 03 2016 | 7:48 pm
      If your argument for a more up-to-date Javascript is newer language features, you could make the jump to CoffeeScript, which I find to be a much more pleasant language to work in (modulo one or two slightly sharp edges in the syntax). It has lambdas, list comprehensions and string interpolation for starters.
    • yaniki's icon
      yaniki's icon
      Aug 04 2016 | 10:56 am
      @Joshua: thanks for mentioning my activities and really comprehensive explanations about Max and JS.
      I'm not a JS expert (especially about versions and implementations), but from my perspective I totally agree about your remarks on the [jweb] object - it's a gate to really nice possibilities. Actually nearly all my projects are in some way connected or controlled over internet and mobile devices and on Max side I'm always using [jweb] to handle this kind of stuff. Also more advanced JS structures (+ browser related actions) are in my opinion easiest to integrate within [jweb].
      And, instead of using "pure" HTML + JS environments such as P5*js are bringing "scripting" into totally next gen level.
      @ESTEVANCARLOS & KNASTERBUGG: try [jweb], guys. For bidirectional communication with Max check my "MaxMSP/Jitter and P5*js" simple solution mentioned by Joshua ( - it' s about P5*js, but working with "ordinary" JS is even simpler.
      And here is a demo, how/why you may use web-content (with a lot of JS) loaded inside [jweb] in deep integration with Max:
      Btw. I'm working on some new stuff intensively using [jweb] and "MaxMSP/Jitter and P5*js" - I think that soon I will be able to share some new ideas and techniques on this forum ;-)
    • Valery_Kondakoff's icon
      Valery_Kondakoff's icon
      Nov 26 2018 | 12:50 pm
      As far as I can see there is still ES5 in Max8 (while Node for Max uses much modern version). Any chances JS in Max to be updated?
    • Joshua Kit Clayton's icon
      Joshua Kit Clayton's icon
      Joshua Kit Clayton
      Nov 27 2018 | 6:20 pm
      @valery There are still no plans to update the internal version of JS as used by the js and jsui objects in Max in the near future. The conditions of my earlier reply on this thread remain the same. For more modern JS usage without transpilation, you can use jweb or node for max, and otherwise, you can make use of a transpiling solution as mentioned (node for max could actually be used to accomplish the transpiling in a more integrated fashion, fwiw).
    • Valery_Kondakoff's icon
      Valery_Kondakoff's icon
      Nov 27 2018 | 11:44 pm
      Joshua, thank you for the info. It's a pity, there are no plans to update JS used in js/jsui to the ES>5, which is _really_ outdated... I'm not sure it is a good idea to support outdated standards in Max, but, of course, there are reasons for this. Maybe one day we will be able to use Node for Max for patcher scripting/working with Jitter? ;)
    • Joshua Kit Clayton's icon
      Joshua Kit Clayton's icon
      Joshua Kit Clayton
      Nov 28 2018 | 12:03 am
      We'd love to migrate to a newer standard, but the amount of low level spidermonkey-API specific code in place for our JS integration makes this prohibitively expensive to do and retain backward compatibility with the 15+ years of user code that exists. Someday we might be able to eliminate that technical debt, but it's something we have to balance as a cost against other desirable features and improvements. Yours and other's requests for this to be updated is registered. Thanks!
      FWIW, most client side JS web developers I know typically transpile their code to ES5 for universal browser support, so I'd encourage you again to not rule that out as a workflow. Babel is pretty great and there's lots of other utilities out there to make it easier than you might otherwise think. Again, Node for Max could be helpful for that.
    • Jay Walker's icon
      Jay Walker's icon
      Jay Walker
      Apr 29 2019 | 10:41 pm
      I used JS with Max as a way to learn Javascript. But to know that they are stuck on a very old version of JS totally defeats the point! I can't really expect to ace an interview without knowing the newest things, only relying on an archaic style of scripting! Please update!!!!!!!!
    • Roman Thilenius's icon
      Roman Thilenius's icon
      Roman Thilenius
      Apr 30 2019 | 1:37 am
      for me it is still a mystery why some people are using javascript or java in max to mostly do things which you can as well do in max itself, where it is 15 times more effective than in javascript.
      mind you, a java SE is not even part of OSX anymore.
    • Florian Demmer's icon
      Florian Demmer's icon
      Florian Demmer
      Apr 30 2019 | 1:52 am
      Just as a heads up, I did some work on a tool to help with porting modern EcmaScript to be run within [js]. Apart from the transpilation it should also support bundling of npm dependencies when possible (f.e. no native extensions). There is some further work to do (it fe. does not account for converting setTimeout/setInterval to use the Task Object atm) but in my limited tests it seemed to do the trick for small scale examples.
      Would definitely appreciate any feedback or contribution to see what might be missing at this point.
      The tool comes in the shape of an CLI tool and is available via npm: For a more contained version or people without a Node install on their machine there is also a simple example wrapping the functionality with N4M:
    • tenandtracer's icon
      tenandtracer's icon
      Dec 13 2019 | 5:19 am
      Only just now noticed this. Wow. Going to spend some time exploring this for sure.
    • Andrew McNaught's icon
      Andrew McNaught's icon
      Andrew McNaught
      Nov 19 2022 | 5:01 am
      Perhaps there is a solution to this problem that does not require a re-write of the js object? I am thinking something along the lines of a new object that serves as a transpiler and bundler? The benefits of being able to quickly leverage the modern JS ecosystem seem to be inline with Max's design philosophy.
    • estevancarlos's icon
      estevancarlos's icon
      Nov 19 2022 | 3:40 pm
      I think you're on to something with the transpiler object idea. One thing Cycling should consider is that many newer people studying JS are only focuses on the recent ECMAscript version. For example, I teach students to avoid the var keyword.
    • fraction's icon
      fraction's icon
      Jan 23 2023 | 8:39 am
      I'm really getting into js in max. Years after just using max. It's very complementary in the environment and I would say almost essential. It became my usual workflow when the project is not just the creation of a patch, but the development of more integrated tools. When you plan to have a patch where a lot of messages have to be sent, the chord patching technics has reached its own limit. Basic algorythmic iteration (and also for loop) are also much easier to think with JS compares to max objects data flow. @roman i think you miss the interest of using js. For most of the classic 'maxmsp' task, using normal max object is way better, but for instance, if you want to develop UI with dynamic controls, a script based langage is much more effective, and allow interacting and maintaining the code in a more efficient way.
      So i understand the issue of updating JS in max, but i would really enjoy to see that happen in a close future :)
    • loadmess's icon
      loadmess's icon
      Feb 08 2023 | 8:57 am
      Sorry my silly question, I just wish to get a broad view of the JavaScript integration in Max. Doesn't node4max uses a more recent ECMAscript / js version? Side note, I wished several times there's was a outside of Gen codebox to overcome those moments where cabling reach their limits. From what I can grasp, codebox architecture would be more efficient.