Hello,
I'm trying to learn the JS API.  I've been following through the tutorials and am currently on buffer and intersect geometry.
As I follow along sometimes I try to adjust things to further learn.  In this case, instead of using the example which uses a featureLayer, I want to do the same thing but on a layer found within a webMap.
So I am replacing this line:
var featureLayer = new FeatureLayer({ url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails_Styled/FeatureServer/0" }); map.add(featureLayer);
with this:
var webmap = new WebMap({
 portalItem: {
 id: "***mywebmapid***"
 }
 });
var view = new MapView({
 container: "viewDiv",
 //*** UPDATE ***//
 map: webmap
 //center: [-118.80500,34.02700],
 //zoom: 13
 });
then instead of using featureLayer in the function, I am trying to use a layer withing the webMap.  I tried this:
var parksLayer = webmap.findLayerById("958f6534812a4407925a2a18a640b841");
and changed the one line to read:
return (result.graphic.layer === parksLayer);
I'm getting an error that says:  Uncaught (in promise) TypeError: Cannot read property 'graphic' of undefined
 at  (pointing to this line   })[0].graphic; )
I'm not sure what I'm doing wrong here.  Can anyone point me in the right direction?
Thanks!!