<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic hasOwnProperty() is only checking if a certain property exists in a JSON, but doesn't return anything if it doesn't in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hasownproperty-is-only-checking-if-a-certain/m-p/1166031#M77060</link>
    <description>&lt;P&gt;I keep trying different methods to check if this JSON contains "attributes." In this way I can determine if the given coordinates are outside of wetlands. If they are in wetlands, "attributes" will exist in the JSON. If they aren't in wetlands, 'attributes' won't be in the JSON.&lt;/P&gt;&lt;P&gt;When I run this function, I am only getting TRUE &lt;A href="https://deepmaterialkr.com/" target="_self"&gt;-&lt;/A&gt; when I type in coordinates that are in a wetland (try 43.088 instead, in the JSON url, which returns true).&lt;/P&gt;&lt;P&gt;However I want FALSE for the given url. For some reason when I do console.log("FALSE"), this doesn't appear or return in the console at all if hasOwnProperty('attributes') == false.&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function(GetData) {

fetch('https://www.fws.gov/wetlandsmapservice/rest/services/Wetlands/MapServer/0/query?where=&amp;amp;text=&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry=-88.305%2C43.060&amp;amp;geometryType=esriGeometryPoint&amp;amp;inSR=4326&amp;amp;spatialRel=esriSpatialRelWithin&amp;amp;relationParam=&amp;amp;outFields=WETLAND_TYPE&amp;amp;returnGeometry=false&amp;amp;returnTrueCurves=false&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=&amp;amp;returnIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;gdbVersion=&amp;amp;returnDistinctValues=false&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;queryByDistance=&amp;amp;returnExtentsOnly=false&amp;amp;datumTransformation=&amp;amp;parameterValues=&amp;amp;rangeValues=&amp;amp;f=pjson&amp;amp;__ncforminfo=qCOZOO8Kyr4uogGcKvxkzzuK7gmavd4CxwTAkdbAsF2_aT4eeNbB0NpLwCYwiAJSf1ZHqY3CKVZ3osgMevhYGQrqRUQZej5oHaSmnSIaiZZb469Cexv-zqqmgYMuFJAAzrcRxvKXPBz9VnYPnMrM6kBNhO-cz6yK_w5T1mqNu_VXSbjBSihVf4_mlUBSVb9yf4C8scYXWm9Iak2Nfn1dtJACNUHLBHSElLvc1wxFMO2eUWNsD3qpCk3kAcRyYftuFU86n7THyk2IvkIUpxNmDHRxmmbgSYvPLMkl8t41Jzjp_bntkIyOWB0u8cQU2VsfASFUdznRkvrvYrQxgR8eyvsPq5oV_ZoPSksVCew6xev0K_TV2NU-kjojYpowMVXpZtCX9P-Q_7m8ywt2PyLPhEVgQB12ji1S7G5FRzIt6E0SDoXMY1vqQvPtedaNYbBCazXgs05L9DFKdtvrwmQVCeLmpBTduIhF9Sk4kozMnFX6GOANrZJMCI9AssN0DjrhlZkgDVw0l1flF44Zli927CXGTQ-oUpwsn7PPypVkN2iDJf-nz9XNbj82sv1c6B5s5UZVwiOp8VHJfZSDJ8BAYR4z_oONT2JwbVSKKlFKeN72f-Y6EejcB9wPKmn5kYjv7CKkRyIIv4F4cqVWxLK9x33uvEDMTvxX')
.then(function(response) {
return response.json();
})
.then(function(data) {
appendData3(data);
})

.catch(function(err) {
console.log('error: ' + err);
});


function appendData3(data) {
for (let obj of data['features']) {

if (obj.hasOwnProperty('attributes') == false) {
console.log("FALSE");
} else {
console.log("TRUE");
}
}
}

};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2022 08:14:49 GMT</pubDate>
    <dc:creator>TahirChutiya</dc:creator>
    <dc:date>2022-04-26T08:14:49Z</dc:date>
    <item>
      <title>hasOwnProperty() is only checking if a certain property exists in a JSON, but doesn't return anything if it doesn't</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hasownproperty-is-only-checking-if-a-certain/m-p/1166031#M77060</link>
      <description>&lt;P&gt;I keep trying different methods to check if this JSON contains "attributes." In this way I can determine if the given coordinates are outside of wetlands. If they are in wetlands, "attributes" will exist in the JSON. If they aren't in wetlands, 'attributes' won't be in the JSON.&lt;/P&gt;&lt;P&gt;When I run this function, I am only getting TRUE &lt;A href="https://deepmaterialkr.com/" target="_self"&gt;-&lt;/A&gt; when I type in coordinates that are in a wetland (try 43.088 instead, in the JSON url, which returns true).&lt;/P&gt;&lt;P&gt;However I want FALSE for the given url. For some reason when I do console.log("FALSE"), this doesn't appear or return in the console at all if hasOwnProperty('attributes') == false.&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function(GetData) {

fetch('https://www.fws.gov/wetlandsmapservice/rest/services/Wetlands/MapServer/0/query?where=&amp;amp;text=&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry=-88.305%2C43.060&amp;amp;geometryType=esriGeometryPoint&amp;amp;inSR=4326&amp;amp;spatialRel=esriSpatialRelWithin&amp;amp;relationParam=&amp;amp;outFields=WETLAND_TYPE&amp;amp;returnGeometry=false&amp;amp;returnTrueCurves=false&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=&amp;amp;returnIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;gdbVersion=&amp;amp;returnDistinctValues=false&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;queryByDistance=&amp;amp;returnExtentsOnly=false&amp;amp;datumTransformation=&amp;amp;parameterValues=&amp;amp;rangeValues=&amp;amp;f=pjson&amp;amp;__ncforminfo=qCOZOO8Kyr4uogGcKvxkzzuK7gmavd4CxwTAkdbAsF2_aT4eeNbB0NpLwCYwiAJSf1ZHqY3CKVZ3osgMevhYGQrqRUQZej5oHaSmnSIaiZZb469Cexv-zqqmgYMuFJAAzrcRxvKXPBz9VnYPnMrM6kBNhO-cz6yK_w5T1mqNu_VXSbjBSihVf4_mlUBSVb9yf4C8scYXWm9Iak2Nfn1dtJACNUHLBHSElLvc1wxFMO2eUWNsD3qpCk3kAcRyYftuFU86n7THyk2IvkIUpxNmDHRxmmbgSYvPLMkl8t41Jzjp_bntkIyOWB0u8cQU2VsfASFUdznRkvrvYrQxgR8eyvsPq5oV_ZoPSksVCew6xev0K_TV2NU-kjojYpowMVXpZtCX9P-Q_7m8ywt2PyLPhEVgQB12ji1S7G5FRzIt6E0SDoXMY1vqQvPtedaNYbBCazXgs05L9DFKdtvrwmQVCeLmpBTduIhF9Sk4kozMnFX6GOANrZJMCI9AssN0DjrhlZkgDVw0l1flF44Zli927CXGTQ-oUpwsn7PPypVkN2iDJf-nz9XNbj82sv1c6B5s5UZVwiOp8VHJfZSDJ8BAYR4z_oONT2JwbVSKKlFKeN72f-Y6EejcB9wPKmn5kYjv7CKkRyIIv4F4cqVWxLK9x33uvEDMTvxX')
.then(function(response) {
return response.json();
})
.then(function(data) {
appendData3(data);
})

.catch(function(err) {
console.log('error: ' + err);
});


function appendData3(data) {
for (let obj of data['features']) {

if (obj.hasOwnProperty('attributes') == false) {
console.log("FALSE");
} else {
console.log("TRUE");
}
}
}

};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 08:14:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hasownproperty-is-only-checking-if-a-certain/m-p/1166031#M77060</guid>
      <dc:creator>TahirChutiya</dc:creator>
      <dc:date>2022-04-26T08:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: hasOwnProperty() is only checking if a certain property exists in a JSON, but doesn't return anything if it doesn't</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hasownproperty-is-only-checking-if-a-certain/m-p/1166049#M77062</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/548755"&gt;@TahirChutiya&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function appendData3(data) {
  data.features.map(obj=&amp;gt;{
    if (obj.hasOwnProperty('attributes')) {
      console.log("TRUE");
    } else {
      console.log("FALSE");
    }
  })
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Apr 2022 12:25:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hasownproperty-is-only-checking-if-a-certain/m-p/1166049#M77062</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2022-04-20T12:25:55Z</dc:date>
    </item>
  </channel>
</rss>

