v1
3/25/2021 by tnifey -00
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
function bitwiseHas(arr, x) {
  return !!~arr.indexOf(x);
}

function compareHas(arr, x) {
  return arr.indexOf(x) !== -1;
}

function includesHas(arr, x) {
  return arr.includes(x);
}

function someHas(arr, x) {
  return arr.some(item => item === x);
}

function forHas(arr, x) {
  for (let item of arr) {
    if (item === x) {
      return true;
    }
  }
  return false;
}

function setHas(arr, x) {
  return new Set(arr).has(x);
}

function filterHas(arr, x) {
  return !!arr.filter(item => x === item).length;
}

function reduceHas(arr, x) {
  return arr.reduce(function (has, item) {
    if (!has) return item === x;
    return has;
  }, false);
}

var test = [2,5,6,12,651,23,5,23,5,122,3,54,5];
var exists = 122;
var notExists = 42;
delete caserun single casemove downdrag and drop case


ready



forHas(test, exists);
forHas(test, notExists);
delete caserun single casemove upmove downdrag and drop case


ready



compareHas(test, exists);
compareHas(test, notExists);
delete caserun single casemove upmove downdrag and drop case


ready



includesHas(test, exists);
includesHas(test, notExists);
delete caserun single casemove upmove downdrag and drop case


ready



someHas(test, exists);
someHas(test, notExists);
delete caserun single casemove upmove downdrag and drop case


ready



bitwiseHas(test, exists);
bitwiseHas(test, notExists);
delete caserun single casemove upmove downdrag and drop case


ready



setHas(test, exists);
setHas(test, notExists);
delete caserun single casemove upmove downdrag and drop case


ready



filterHas(test, exists);
filterHas(test, notExists);
delete caserun single casemove updrag and drop case


ready



reduceHas(test, exists);
reduceHas(test, notExists);
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN