Smooth anchors scrolls

Script that adds smooth scroll on every anchor element with id as href.

Object.entries(document.querySelectorAll('[href^="#"]'))
    .forEach(([ index, node ]) => {
        node.addEventListener('click', (event) => {
            event.preventDefault();

            window.scrollTo({
                top: document.querySelector(event.currentTarget.getAttribute('href')).getBoundingClientRect().top - 50,
                behavior: 'smooth'
            });
        });
    });
$ cd ..