I feel like a noob, but I haven't worked that much with JS objects. I want to create a object so I can apply some custom functions to the DOM elements.
Sorry for being unspecific. I have ppdated my questions with more complete picture of my code.
menuItemArr = navBar.querySelectorAll('.kx-menu__link');
[].forEach.call(menuItemArr, function(menuItem) {
menuItem.addEventListener('click', function(e) {
e.preventDefault();
toggleMenuItem(this);
});
});
function toggleMenuItem(menuLink){
let obj = obj_menuItem(menuLink);
obj.showClasses();
}
let obj_menuItem = function(e){
classes = e.classList;
function showClasses() { console.log(classes); }
};
results in TypeError: obj is undefined