Check if an array includes a value - Node.js Array

Node.js examples for Array:Array Value

Description

Check if an array includes a value

Demo Code


"use strict";// w w  w .  ja  va2  s  . c o  m

if (!Array.prototype.includes) {
  Array.prototype.includes = function (value) {
    return this.indexOf(value) > -1;
  };
}

Related Tutorials