I just do study JavaScript and I want to execute window.scrollTo()
function when page is reloaded, but it doesn't work.
window.scrollTo(0, 200)
I know one way that worked:
setTimeout(() => {
window.scrollTo(0, 200);
},1)
but I don't want to try this. Is there another option? I want to get the scroll activity to happen when page is loaded.