Nodejs Utililty Methods Array Contain Object

List of utility methods to do Array Contain Object

Description

The list of methods to do Array Contain Object are organized into topic(s).

Method

containsObject(obj)
Array.prototype.containsObject = function(obj){
    var i;
    for (i = 0; i < this.length; i++) {
        if (this[i] === obj) {
            return true;
    return false;
};
...
containsObject(obj)
Array.prototype.containsObject = function (obj) {
    var contains = false;
    for (var i = 0; i < this.length; i++) {
        if (this[i] == obj) {
            contains = true;
    return contains;
};
...
containsObject(obj)
Array.prototype.containsObject=function(obj){
  var haveObj=false;
  for(var i=0;i<this.length;i++){
    if(this[i]==obj){
      haveObj=true;
      break;
  return haveObj;
...
containsObjectById(id)
Array.prototype.containsObjectById = function (id) {
    for (var i = 0; i < this.length; i++) {
        if (this[i].id === id) {
            return true;
    return false;
};