Function Updated 17 Oct 2026
Array.includes(value, [fromIndex])
Checks whether the array contains a value.
Parameters
valueanyrequiredValue to search for.
fromIndexnumberoptionalIndex to start searching from. A negative value counts from the end of the array.
Returns
true if the value is found, otherwise false.
Values are compared with .NET equality, without type conversion: "1" does not match 1, and an object matches only if it is the same instance. NaN is found.
Example
Normal JavaScript, running in the browser or on the Docly™ server.
const roles = ["editor", "admin"];
write(roles.includes("admin")); // true
write("\n");
write(roles.includes("Admin")); // false - the comparison is case-sensitive
write("\n");
write([1, 2, 3].includes(1, 1)); // false - the search starts at index 1The JavaScript above produces this output:
true
false
false