Skip to content

includes

Subhajit Sahu edited this page May 3, 2023 · 16 revisions

Check if array has a value.

Similar: search, indexOf, isValue, includes.


function includes(x, v, i)
// x: an array
// v: search value
// i: begin index [0]
const xarray = require('extra-array');

var x = [1, 2, -3];
xarray.includes(x, 3);
// → false

xarray.includes(x, -3);
// → true


References

Clone this wiki locally