Using matchMedia for reduced motion

// example of variable setting
let reduceMotion = false;
  /* Check for reduced motion - note that if the browser can support arrow functions, it can support this match-media */
  if(window.matchMedia){
    const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
      mediaQuery.onchange = () => {
      // Stop JavaScript-based animations - or other logic
      reduceMotion = true;
    };
  }
}