var myArray = [
   { 'name' : 'some name', id: 23131, 'has' : ['dogs'] },
   { 'name' : 'some name 2', id: 8678, 'has' : ['dogs', 'cats'] },
   { 'name' : 'some name 3', id: 2125 , 'has' : ['donkeys', 'goats']},
   { 'name' : 'some name 4', id: 90867, 'has' : ['parrots', 'treasure'] },
   { 'name' : 'some name 5', id: 435458, 'has' : undefined },
];

var Find = function(value,obj) {
	var sameArrays = function(arr,arr1) {
		var r;
	
		if(arr.constructor != Array || arr1.constructor != Array) {return r;}

		if(arr.length != arr1.length) { return r; }
		
		for (var i = arr.length - 1; i >= 0; i--){
			var value = arr[i],
				item = arr1[i];
					
			r = Find(value,item);
			
			break;
		};
		
		return r;		
	};
	
	var sameObjects = function(obj,obj1) {
		var r;
		
		if(obj.constructor != Object || obj1.constructor != Object) {return r;}
		
		for(var i in obj) {
			var value = obj[i],
				item = obj1[i];
					
			r = Find(value,item);
			
			break;
		};
		
		return r;
	};
		
	var inArray = function(value,obj) {
		var r;
				
		if(value.constructor == Array && sameArrays(value,obj)) {
			return obj;
		}
		
		for (var i = obj.length - 1; i >= 0; i--){
			var item = obj[i];
			if( Find(value,item) ) {
				r = item;
				break;
			}
		};
		
		return r;
	};
	
	var inObject = function(value,obj) {
		var r;
		
		if(obj.constructor != Object || typeof obj == 'undefined') {return r;}
		
		if(value.constructor == Object && sameObjects(value,obj)) {
			return obj;
		}
		
		for(var i in obj){
			var item = obj[i];
			if( Find(value,item) ) {
				r = item;
				break;
			}
		}
		
		return r;
	};
	
	var inString = function(value,string) {
		var r,
			valueConstructor = value.constructor;
		
		if(valueConstructor == Object || valueConstructor == Array || typeof string === 'undefined' ) {
			return r;
		}
		string += '';
		if(value == string || value.toString() == string.toString()) {
			r = string;
		}
		else if((valueConstructor == RegExp || valueConstructor == String) && string.match(value)) {
			r = string;
		}
		else if(valueConstructor == Function && value(string) == true) {
			r = string;
		}
		
		return r;
	};

	
	if(typeof obj === 'undefined' || typeof value === 'undefined') {
		return;
	}
	
	var	_return,
		type = value.constructor,
		objType = obj.constructor;
			
	if(value == obj) {
		_return = obj;
	}
	else if( objType == Array) {
		_return = inArray(value,obj);
	}
	else if (objType == Object ) {
		_return = inObject(value,obj);
	}
	else if ( objType == String || objType == Number ) {
		_return = inString(value,obj);
	}
	
	return _return;
};
(function() {
  var r = [];
  for (var i = myArray.length - 1; i >= 0; i--){
    if( Find(/8/,myArray[i]) ) { r.push(myArray[i]); }
  };
  alert(r.length+' items has the number \'8\' somewhere')
})();