Anyone Help me Javascript arrays

resultData  [
  RowDataPacket {
    id: 496,
    insta_image_id: '1038',
    product_id: '7090802819115',
    top_cord: '52.07',
    left_cord: '35.77',
    img_src: 'https://cdn.example.com/shoppable-photogallery/6/Ricecracker-Bag-pack-1681204220356-675192996.jpeg',
    title: 'Blue Kale and Blackberry',
    type: 0,
    shop_domain: 'futura-connect.com',
    handle: 'blue-kale-and-blackberry',
    insta_gallery_id: 43
  },
  RowDataPacket {
    id: 497,
    insta_image_id: '1038',
    product_id: '7090802655275',
    top_cord: '56.45',
    left_cord: '27.74',
    img_src: 'https://cdn.example.com/shoppable-photogallery/6/Ricecracker-Bag-pack-1681204220356-675192996.jpeg',
    title: 'Apple Strawberry',
    type: 0,
    shop_domain: 'futura-connect.com',
    handle: 'apple-strawberry',
    insta_gallery_id: 43
  }
]

I want put product_img about arrays let me how do this because second array come from another server result. I need to done on node side but the script executed fastly so don’t added the prodcut_img can you explain it
Another array is :

ResultData2 [
  { productByHandle: null },
  { productByHandle: null },
  {
    productByHandle: {
      id: 'gid://shopify/Product/7109430902827',
      handle: 'bo-ivy',
      images: [
            img-url: img-url,
     ],
      title: 'Bo Ivy',
      productType: 'bags',
      description: 'The Stormi Bag takes utilitarianism seriously, featuring dual straps. The one-size leather strap is ideal for slinging over the shoulder snugly and a marble-effect acrylic chain serves as either a top handle or a shorter shoulder strap. Designed to carry only the essentials, and one card slot features on the rear side for easy card access.',
      priceRangeV2: [Object]
    }
  },
  {
    productByHandle: {
      id: '7109429723179',
      handle: 'glass-vases-set',
      images: [{
            img-url: img-url,
       }],
      title: 'Glass Vases Set',
      productType: 'sets',
      description: 'Designed by Space Copenhagen, these vases sits within the Collect series, a curated line of beautifully crafted soft furnishings and home objects. Made from three layers of mouth-blown glass, the result is a unique thickness and unusual nuance of colour. They are available in four sizes: 24 x 20cm; 40 x 18.5cm; 50 x 19cm; and 60 x 28cm.',
      priceRangeV2: [Object]
    }
  },

below is my code

  resultData.map(async(item1,index)=>{
             ResultData2 .map((item,i)=>{
            if(item.productByHandle){
              if(item.productByHandle.id.split('/').pop() === item1.product_id){
                console.log(item.productByHandle.images.edges[0].node.url)
                result[index]['product_img'] = (item.productByHandle.images.edges[0]?.node) ? item.productByHandle.images.edges[0].node.url : ""
              }
            }
          })
        });

i just want resultData with product imge

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.