How do I toggle a css class to elements of the same class, on click of another single element, in pure JavaScript?

I want to toggle a css class on all elements with the same class, on click of another element. I had it working with jQuery but need to switch to pure JavaScript. The lovely jQuery that works:

$(function () {
            $("#logo").click(function () {
                $(".grey").toggleClass("white",1000);
                $(".red").toggleClass("orange",1000);
        });
        });

—when you click on the element with id=”logo”, everything with class=”grey” toggles “white” class and everything with class=”red” toggles “orange”. Perfect.

I’ve googled like mad for a solution to this, but I can’t get anything to work even though it seems like a simple thing — I’ve taken over a day to try to learn what I need to know but a solution is escaping me. (Scripting is not my first language by any stretch.) Thank you in advance.