shopify get jquery code more readable, usable Hi so like in my question, 
i wrote some part of code for shopify to get recent orders for past 30 day
and i wondering if it is really readable, or maybe i schould change something?

I mean maybe there is a better way to achive same result.

Or maybe i schould use different names? change position for function?

$(document).ready(function() {
    const collection = [];

    //set minimum recent order limit to show
    const minimumOrders = 2;

    //set number of days for recent orders
    const numberOfDays = 30;

   let date = new Date();
   date.setDate(date.getDate() - numberOfDays)
   let startDate = date.toISOString();


    function insertData(item, quality){
      //part of code that will be executed for cert page
      if($( "input[value='"+item+"']" )){
        $( "input[value='"+item+"']" ).parent().append("&lt;em class='text-success'&gt;"+quality+" purchased recently&lt;/em&gt;");
      }
      //part of code that will be executed for checkouts
      if($("tr[data-variant-id='"+item+"']")){
        $("tr[data-variant-id='"+item+"'] &gt; .product__description").append("&lt;em class='text-success'&gt;"+quality+" purchased recently&lt;/em&gt;");
      }
    }

    function countOrders(){
      $.getJSON('/admin/api/2020-01/orders.json', function (data ) {
        ordersEl = data.orders;

        ordersEl.forEach( function(element, index) {
          if(element.created_at &gt; startDate) {
            element.line_items.forEach( function(item, index) {
              if(collection.hasOwnProperty(item.variant_id)){
                newValue = collection[item.variant_id]['quantity'] + item.quantity;
                collection[item.variant_id]['quantity'] = newValue;
              }
            });
          }
        });

        for(el in collection) {
          if(collection[el]['quantity'] &gt; minimumOrders){
            insertData(el, collection[el]['quantity'])
          }
        }
      }); 
    }

    $.getJSON('/cart.json', function (data ) {
      data.items.forEach( function(element, index) {
        collection[element.id] = [];
        collection[element.id]['quantity'] = 0; 
      });

      countOrders();
    });
  });


every comment, suggestion will be relevant

i do arrow functions and i think there is something more i can do but... the code just stop working...

i would like to change that one :

for(el in collection) {
   if(collection[el]['quantity'] &gt; minimumOrders){
      insertData(el, collection[el]['quantity'])
   }
}


for:

collection.map( el =&gt; ((collection[el]['quantity'] &gt; minimumOrders) ? insertData(el, collection[el]['quantity']) : null)
Use const &amp; let instead of vars
Create Docblock for functions
Arrow functions ES6