My JavaScript code does not work because of querySelector

I’m new to java script and have a long way to go off learning, and attempted to make something but it doesn’t not work.

Here’s the code:

var LIS = document.getElementsByClassName("Links")[0].querySelector("ul").querySelector("li").querySelector("a");

for (let Index in LIS){
  LIS[Index].mouseenter = function(){
    console.log("Test");
  };
};

Here’s the error I get
Img

function main(){
    document.getElementsByClassName("Links")[0].querySelector("ul").querySelector("li").querySelector("a").onmouseenter = function(){
        console.log("Test")
    }
}

This one didn’t log anything in the console.