Link to home
Start Free TrialLog in
Avatar of Howard Bash
Howard BashFlag for United States of America

asked on

JavaScript Arrays and objects

I am getting back an object from a rest call which contains results from a SharePoint REST call.  The returned data has dups (which are indeed in the list).

I want to dedup the data and then return it to be used elsewhere.  It looks something like the following:

function DedupeList(flist) {
                var listlength = flist.length;
                var newObject=[];
                var currentID = flist.results[0].FID;
                for (var ptr=1; ptr<listlength; ptr++) {
                                if (flist.results[ptr].FID!=currentID) {
                                                currentID = flist.results[ptr].FID;
                return newFilmsObject;                

Open in new window

The issue is I want to return an object like the passed in data set from the REST call and am not sure if the array I am using to build the deduped set will work.
Avatar of Leonidas Dosas
Leonidas Dosas
Flag of Greece image

Would you like to give us an object sample to see the structure of the object that you want to dedup?
Avatar of Member_2_248744
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been inactive for 14 days, with no comment from the author. Force Close this question, answer to code that gives a duplicate cleared array.