How to detect a CSS class is active in or change CSS class name using Javascript [duplicate]

I have the following html codes:

    <li class="imagenav active">
      some codes go here
    </li>

Is there a way of checking if imagenav class is active or change CSS class using Javascript. for example:

    if imagenav is active {
      do some codes here ...
    }

Many thanks in advance.

Thank you for Barmar for advising how to check if a list has a class. However, in my case, I prefer to change CSS class using Javascript which makes it easier to manipulate my codes. So I have to add id into HTML codes. I want the left arrow to be active/disabled when the page is first loaded. Here are my fully working codes:

    <div id="active-leftarrow" class="imagenav">
      <script type='text/javascript'>
        document.getElementById('active-leftarrow').className = 'imagenav disabled';
      </script>
    </div>

Many thanks