I can not add class by using e.preventDefault() method in Javascript

`I made a menu bar with HTML and CSS. I would link to add a specific class and will be worked href by using JS wherever I click, but I click any menu Item a href is not working.

MY HTML code is here.

<div class="main-header">
      <h2><a href="index.html"> Javascript All projects </a></h2>
    </div>
    <div id="main-content">
      <div class="menu-bar-all-project">
        <ul>
          <li class="single-menu-class">
            <a href="index.html"> 1. Stopwatch </a>
          </li>
          <li class="single-menu-class">
            <a href="2_watch.html"> 2. Watch </a>
          </li>
          <li class="single-menu-class">
            <a href="3_countdown.html"> 3. Countdown </a>
          </li>
          <li class="single-menu-class">
            <a href="4_accordion.html"> 4. Accordion </a>
          </li>
          <li class="single-menu-class">
            <a href="5_popup.html"> 5. Popup </a>
          </li>
          <li class="single-menu-class">
            <a href="6_calculator.html"> 6. Calculator </a>
          </li>
        </ul>
      </div>

My Javascript code is here.

const mwMenuItem = document.querySelectorAll(".single-menu-class");
for (let i = 0; i < mwMenuItem.length; i++) {
  mwMenuItem[i].addEventListener("click", (e) => {
    for (let j = 0; j < mwMenuItem.length; j++) {
      if (i == j) {
        mwMenuItem[j].classList.toggle("mw-menu-active");
      } else {
        mwMenuItem[j].classList.remove("mw-menu-active");
      }
    }
    e.preventDefault();
  });
}`

Thank you in advance.

I tried in Googled an Yotube. However I did not get any expected result. 
I belive, someone will help me to fix it.