How to listen to scroll event in JavaScript

DOM
By Jad Joubran · 
Last updated Nov 05, 2018
window.addEventListener("scroll", event => {
  console.log("Window scrolled", event);
});