includes(searchIn: string | string[] | null | undefined,searchFor: string | string[] | null | undefined): boolean
Determines if searchIn contains the given searchFor term(s).
When searchIn is a string, this performs a substring check.
When searchIn is a list, this performs an element check.
When searchFor is a list, every item must be found.
Example 1
Example 1
includes("hello world", "hello"); // true includes("hello world", ["hello", "world"]); // true includes("hello world", ["hello", "moon"]); // false includes(["a", "b", "c"], "a"); // true includes(["a", "b", "c"], ["a", "b"]); // true includes(["a", "b", "c"], ["a", "d"]); // false includes("hello world", []); // true includes(null, "hello"); // false includes("hello world", undefined); // false