In my application, I want to determine the current scroll position, so I have been using this to do so (source: https://www.codegrepper.com/code-examples/javascript/get+current+scroll+position+javascript)
window.pageYOffset || document.documentElement.scrollTop
Problem: When I console.log this, it only returns 0 when the page is not positioned and the top.
Question: Is there an alternative way to get the current scroll position?