Classifying top and bottom navigation links
You can have a function to which you will pass your links as an object (will be passed by reference) and classes. In the function, if you will pass the top or bottom links, they will be passed by reference and every change in the function will affect the original object.

function setClasses(links, classes){
    for(var i = 0; i &lt; links.length; i++){
       if( (links[i].getAttribute('href').indexOf('a') &gt; -1) ){
           links[i].className += classes[0];    
       } else if ( links[i].getAttribute('href').indexOf('b') &gt; -1 ){
           links[i].className += classes[1];
       }  
     }
}


Used like this:

var topLinks = document.querySelectorAll('.navUtility-listItem a');
var bottomLinks = document.querySelectorAll('.footerMain-listPlatformItem a');

setClasses(topLinks, [' top-nav-a', ' top-nav-b']);
setClasses(bottomLinks , [' bottom-nav-a', ' bottom-nav-b']);