function animate(pulse_class, id){
  let cart_badge = document.getElementById(id);

  const animation_end_events = ['webkitAnimationEnd', 
                        'mozAnimationEnd', 
                        'MSAnimationEnd', 
                        'oanimationend', 
                        'animationend'];
  const animated_class = "animated";

  cart_badge.classList.add(pulse_class, animated_class);
  for(var animate_end_event of animation_end_events){
    cart_badge.addEventListener(animate_end_event, function(e){
      cart_badge.classList.remove(pulse_class, animated_class);
    });
  }    
}

window.onload = function(){
  const pulse_class = "pulse";
  const ids = ['cart-desktop', 'cart-mobile'];

  var add_to_cart_buttons = document.getElementsByClassName('Button-store');
  for (var button of add_to_cart_buttons){
    button.addEventListener("click", function(e){
      e.preventDefault();
      for(var id of ids){
        animate(pulse_class, id);      
      }
    })
  }
};
@@ -407,16 +407,70 @@
 for(var 
+i = 0; i %3C animation_end_events.length; i++)%7B%0A    var 
 animate_
@@ -479,18 +479,17 @@
 d_event 
-of
+=
  animati
@@ -501,18 +501,20 @@
 d_events
-)%7B
+%5Bi%5D;
 %0A    car
@@ -852,17 +852,69 @@
 var 
-button of
+i = 0; i %3C add_to_cart_buttons.length; i++)%7B%0A    var button =
  add
@@ -929,18 +929,19 @@
 _buttons
-)%7B
+%5Bi%5D
 %0A    but
@@ -1027,19 +1027,61 @@
 var 
-id of ids)%7B
+j = 0; j %3C ids.length; j++)%7B%0A        var id = ids%5Bj%5D;
 %0A   

update to old style for loops