Object doesn't support this property or method

Hi All,

I am getting an error that says "Object doesn't support this property or method"

It points to this line return ary.filter(function(elem) {  

	    operation: "GetListItems",
		listName: "Projects",
		async: false,
		CAMLViewFields: "<ViewFields><FieldRef Name='SiteProjectedAmount' /></ViewFields>",
		CAMLQuery: cml,
		completefunc: function (xData, Status) {	
		$(xData.responseXML).find("z\\:row").each(function () {		
				var ProjectItem = new Object();
				ProjectItem["AmountProjected"] = checkForUndefined($(this).attr("ows_SiteProjectedAmount"));
				ProjectItem["ProjectNumber"] = $(this).attr("ows_ProjectNumber");
				/*var x = checkForUndefined($(this).attr("ows_SiteProjectedAmount"));
				annualCost += parseFloat(x);*/
var uniqBy = function(ary, key) {
    var seen = {};
    return ary.filter(function(elem) {
        var k = key(elem);
        return (seen[k] === 1) ? 0 : seen[k] = 1;

uniqs = uniqBy(AnnualizedDataArray, JSON.stringify);
values = uniqs.map(function(x) { for(var k in x) return x[k] });
annualCost = values.reduce(function(a, b) { return a + b });

Open in new window

It works in jsfiddle. http://jsfiddle.net/GTpgA/41/

Any ideas?

IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobOwner (Aidellio)Commented:
What javascript framework are you using?  in your fiddle you're using mootools but this topic is listed at jQuery.  jQuery has its own filter function that may interfere but I'm suspecting after a bit of testing (changing your fiddle to use jQuery then no framework and it's still working) that the actual error is elsewhere in your code.

I would output to the console (console.log() instead of alert, you'll see more) the contents of AnnualizedDataArray before the uniqBy function, for instance to see if the data is in the format you expect.
IsaacSharePoint Client Side DeveloperAuthor Commented:
What's the best way to see what's in an array?  This is all being done in SharePoint which is really a web page.
RobOwner (Aidellio)Commented:
If you use console.log() it will dump the contents of the stay to the console. You can get to the console vis the developer tools by pressing f12
RobOwner (Aidellio)Commented:
so in other words:

uniqs = uniqBy(AnnualizedDataArray, JSON.stringify);

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.