I'm having a problem exporting javascript function because of eventlistener, I couldn't find any solution online, any suggestions?
//home.js
let mostDemanded=[1,2,3];
export default function myArr(){
return mostDemanded;}
//removing "Explore" nav nothing special
let moveToMain=document.getElementById("moveToMain");
moveToMain.addEventListener('click',()=>{
moveToMain.style.display="none";
})
//login.js
import myArr from '../js/home.js';
let arr=myArr();
console.log(arr);
//Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') at home.js:9