Skip to content

includes

Subhajit Sahu edited this page Feb 2, 2021 · 16 revisions

Checks if array has a value. 🏃 📼 📦 🌔 📒

Similar: search, indexOf, isValue, includes.


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

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

array.includes(x, -3);
// true


References

Clone this wiki locally