JSFiddle - React, Tailwind, and code Playground
JavaScript
function superbag(haystack, needle) {
var i = 0;
var j = 0;
function search_array(inc, spot) {
j = jQuery.inArray(needle[inc], haystack, spot);
return j;
}
for (i = 0; i < needle.length; i++) {
search_array(i, j);
}
if (j > -1) {
alert(true);
} else {
alert(false);
}
}
var array_dates_days = [4, 5, 6, 0];
var array_weekend = [5, 6, 0, 1];
superbag(array_dates_days, array_weekend);
/*var a = [ true, "lipsum" ];
Array.prototype.contains = function (array) {
for (var x = 0; x < array.length; x++) {
if (this.length < x || this[x] !== array[x]) {
return false;
}
}
return true;
}
console.log(a.contains([true, 'lipsum']), a.contains(['lipsum', true]), a.contains([true]), a.contains([true, 'lipsum', 'flotsam']));
*/