I have the code below to perform operations on the classList of every DOM-Element in the given list.
function editClassListOfElements(elements, className, operation) {
    switch (operation) {
        case "add":
            [].forEach.call(elements, function (element) {element.classList.add(className)});
            break;
        case "remove":
            [].forEach.call(elements, function (element) {element.classList.remove(className)});
            break;
        case "toggle":
            [].forEach.call(elements, function (element) {element.classList.toggle(className)});
            break;
        default:
            break;
    }
}
and I want to change it to something like this:
function editClassListOfElements(elements, className, operation) {
    [].forEach.call(elements, function (element) {element.classList. + operation + (className)});
}
If this is possible, how is it done?
 
    