Is there anyway to utilize the array.includes method in JS or Python on an Arcade project? I know it works for Strings, but it errors when attempted on arrays.
I’ve taught students the work around for loop, but it’s so much more tedious than just using the built in method.
@taftteacher the typical JavaScript-y way to do this is to use Array.indexOf() instead. If the item is not in the array, indexOf will return -1. In fact, you can implement includes like so:
Of course! I’m used to indexOf for Java arrays but i totally was not connecting the two because my mind goes right to thinking of list-y functions for JS. Appreciate your help!