title: Array From API Response Doesn't Parse As Array When Using find or includes(Cypress, Node, Javascript)
body: <p>I created an array from a http response, and am attempting to iterate against an object list to create a second array of keys where the keys value is found in my http response array.  But I noticed for some reason using <code>find</code> or <code>includes</code>, the if statement never evaluates to true.  But if I replace my http array with an array of the exact same contents, it evaluates to true.</p>
  <pre><code>for (const property in partners) {
      cy.log('PARTNER SKU LIST', partnerSkuList);
      if (partnerSkuList.find((elem) =&gt; elem === partners[property])) {
        cy.log('TRUE');
        partnerNames.push(property);
      }
    }
    cy.log('NAMES LIST', partnerNames);
  </code></pre>
  <p>Log output:</p>
  <pre><code>PARTNER SKU LIST, [3]
  NAMES LIST, []
  </code></pre>
  <p>Defining variable as array with same value:</p>
  <pre><code>for (const property in partners) {
      partnerSkuList = [3];
      if (partnerSkuList.find((elem) =&gt; elem === partners[property])) {
        cy.log('TRUE');
        partnerNames.push(property);
      }
    }
    cy.log('NAMES LIST', partnerNames);
  </code></pre>
  <p>Log output:</p>
  <pre><code>TRUE
  NAMES LIST, [abc]
  </code></pre>
  <p>UPDATE:
  Did some checking and my array is empty:</p>
  <pre><code>Given('the principal catalog identifier setting is set to partner_sku', () =&gt; {
    // Get a list of item checkin methods for all partners
  
    const partnerSkuList = [];
    const partnerNames = [];
  
    function partnerSettingsRequest(code, response) {
      cy.request({
        method: 'POST',
        url: Cypress.env('adminApiUrl'),
        headers: {
          Authorization: `Bearer ${token}`,
          'Content-type': 'application/json',
          'x-company-app-name': 'admin:tests-ui',
        },
        body: {
          query:
            `query getSettingsByCode($code: String!) {
            configurationByCode(code: $code) {
              data {
                value
                partnerId
              }
            }
          }`,
          variables: {
            code,
          },
        },
      }).then(response);
    }
  
    const partnerSkuResponse = (res) =&gt; {
      for (let i = 0; i &lt; res.body.data.configurationByCode.length; i += 1) {
        if (res.body.data.configurationByCode[i].data.value !== null
          &amp;&amp; res.body.data.configurationByCode[i].data.partnerId !== null
          &amp;&amp; res.body.data.configurationByCode[i].data.value.includes('partner_sku')
          &amp;&amp; Object.values(partners).includes(res.body.data.configurationByCode[i].data.partnerId)) {
          partnerSkuList.push(res.body.data.configurationByCode[i].data.partnerId);
        }
      }
      return partnerSkuList;
    };
  
    partnerSettingsRequest('checkin_cid1', partnerSkuResponse);
  
    for (const property in partners) {
  
      if (partnerSkuList.length === 0) {
        cy.log('ARRAY EMPTY');
      }
  
      cy.log('PARTNER SKU LIST', partnerSkuList);
      if (partnerSkuList.includes(partners[property])) {
        cy.log('ADDING PROPERTY');
        partnerNames.push(property);
      }
    }
  
    cy.log('NAMES LIST', partnerNames);
  </code></pre>