JavaScript 2.0 Identify Sample

Discussion created by rdunfey on Aug 4, 2010

I'm sure these are simple answers?  I'm trying to modify the Identify task sample to work with any number of layers, instead of just the 3 which are specified in the sample, but I'm a bit lost on the purpose for some of the lines of code, some comments would be useful.

For example, what happening here:

        layer2results = {displayFieldName:null,features:[]};
        layer3results = {displayFieldName:null,features:[]};
        layer4results = {displayFieldName:null,features:[]};

        for (var i=0, il=idResults.length; i<il; i++) {
          var idResult = idResults[i];
          if (idResult.layerId === 2) {
            if (!layer2results.displayFieldName) {layer2results.displayFieldName = idResult.displayFieldName};

How come displayFieldName is so important?  What is the feature:[] array, where does that come from?

Any help appreciated,