How to test if an array contains an element?

Pawel Panasewicz's icon

There is no `Array.include` function or I am blind and can't find it.

How to test if an array contains an element?

kLSDiz's icon

You can use Array.indexOf and check if the result is greater than -1. Or Babel.
Max uses a little dated version of JS (IIRC Mozilla JS 1.8.5, which is in essence ES5 with some additions). It was discussed here many many times. Devs don't intend to upgrade it any time soon, if ever.

https://cycling74.com/forums/any-plans-to-update-support-for-recent-versions-of-js#reply-58ed21d5c2991221d9ccad8c

https://cycling74.com/forums/max-8-js-question-for-devs