inArray

inArray(array array, any element) → boolean inArray
Checks whether given element is inside given array.

Determines whether the element element is in the array array.

Parameters
Return
TypeScript

In JavaScript, a.includes(value) compares strictly, without type conversion: [1].includes("1") is false, just like inArray, and so is [1].includes(true). On objects, the comparison is based on identity, not on content: two objects with identical content are two different values. Use a.some(x => ...) to compare differently.

Python

In Python, value in a compares with == like inArray, but booleans are integers there: True in [1] and 1 in [True] are True, whereas inArray tells them apart. On a string, in looks for a substring, not an element — "a" in "abc" is True, "a" in ["abc"] is False. If you test membership often, convert to a set once: value in set(a).