_.memoize = function(func) { var alreadyCalled = false; var result; var arr = []; return function() { //console.log(arguments[0]); if (!alreadyCalled) { if ( !(arr.join(' ')).includes(arguments[0])) { arr.push(arguments[0]); result = func.apply(this, arguments); alreadyCalled = true; } else { //arr.push(arguments[0]); alreadyCalled = true; } return result; } return result; }; };