AnsweredAssumed Answered

How do I evaluate a layer name?

Question asked by csergent08 Champion on May 11, 2015
Latest reply on May 11, 2015 by kenbuja

I have the following code that defines my feature layers, but I would like to evaluate the layer name to ensure that the numbered layer is the correct feature that I am referencing on the chance layers are added. How would I do this?


var initialExtent = new Extent({
        "xmin": 777229.03,
        "ymin": 1133467.92,
        "xmax": 848340.14,
        "ymax": 1185634.58,
        "spatialReference": {
            "wkid": 3435
    // app configuration  
    var config = {

        mapOptions: {
            showAttribution: false,
            sliderStyle: "small",
            extent: initialExtent,
            logo: false,
            sliderPosition: "bottom-right"

        signLayerUrl: "",
        supportLayerUrl: ""



I tried doing the following:

var featureService = new FeatureLayer("");




And receive the following error:


ypeError: Cannot read property '0' of undefined


"in domReady callback"

"TypeError: Cannot read property '0' of undefined


I thought that this would provide me with the name of  the first layer, but I am receiving an error instead. How should I write this?


And I referenced this, but there are no examples: LayerInfo | API Reference | ArcGIS API for JavaScript