title: How to do a function inside another function in JS
body: <p>I have this JS Code</p>
  <pre><code>function toggleMenu() {
      if(!showMenu) {
          hamburger.classList.add('open');
          nav.classList.add('open');
          menuNav.classList.add('open')
          //navItems.forEach(item =&gt; item.classList.add('open'));
          showMenu = true;
  
      } else {
          hamburger.classList.remove('open');
          nav.classList.remove('open');
          menuNav.classList.remove('open');
          //navItems.forEach(item =&gt; item.classList.remove('open'));
          showMenu = false;
      }
  }
  </code></pre>
  <p>I need to make a function for this 2 lines: <code>navItems.forEach(item =&gt; item.classList.remove('open'));</code> and <code>navItems.forEach(item =&gt; item.classList.add('open'));</code> without using '=&gt;' cause my uglify cant compress this syntax.</p>
  <p>Any advices ?</p>