Select to view content in your preferred language

hitTest remove or hide ---- response.results.filter(...)[0] is undefined

619
1
03-30-2022 07:00 AM
Vakhtang_Zubiashvili
Frequent Contributor

Hi all,

 

I am using hitTest to get layer attributes in my webmap. For layers, which i do not use in hitTest i get error: response.results.filter(...)[0] is undefined. i tried a lot, but could not remove this error or hide. It does  nothing, but it is annoying to see in console. 

 

Any ideas? 

 

Thanks

0 Kudos
1 Reply
ReneRubalcava
Honored Contributor

Do you have a snippet or something to show how you are using hitTest and doing this filter? If there are no results, accessing it via array[0] will be undefined on an empty array. You can use response.results.find() and check for null instead. But you should be doing some kind of null checking in this scenario.

0 Kudos