var links = document.getElementsByClassName('link');
var linksArr = Array.prototype.slice.call(links);
linksArr.forEach(function(item, linksArr) {
var location = window.location.href;
var link = item.href;
var result = location.match(link);
if(result != null) {
item.classList.add('active');
item.id('nav-link-active');
}
item.classList.add
работает, а item.id
нет?