我用 ES6 编写了 javascript,但它在 IE 中不起作用。我如何更改 javascript 的旧版本

I wrote javascript with ES6, but It's not working in IE. How could I change old version of javascript

我用 ES6 编写了 javascript,但它在 IE 中不起作用。特别是IE9。我如何更改 javascript 的旧版本。我尝试将 ES6 翻译成旧版本,但我做不到。因为我先学了ES6

const btns = document.querySelectorAll(".btn");
  Array.from(btns).forEach(item => {
    item.addEventListener("click", () => {
      const selected = document.querySelectorAll(".btn.active");
      selected[0].className = selected[0].className.replace(" active", "");
      item.className += " active";
  });
});

const setActive = el => {
    [...el.parentElement.children].forEach(sib => sib.classList.remove("active"))
    el.classList.add("active")
  }

const setPlace = el => {
  const hasClass = el.classList.contains("active");
  const parent = el.parentElement.parentElement;
  if (!hasClass) {
      el.classList.add("active");
      parent.classList.add("active");
  } else {
      el.classList.remove("active");
      parent.classList.remove("active");
  }
}

const spans = [...document.body.querySelectorAll(".choose .table_mid ul > li")]
const place = [...document.body.querySelectorAll(".search_contents .place")]
spans.forEach(el => el.addEventListener("click", e => setActive(el)))
place.forEach(el => el.addEventListener("click", e => setPlace(el)))

使用 Babel 编译器。 Babel REPL

如果您使用 preset-envtarget 选项,您可以为 IE9 编写代码。