
Ask HN: JavaScript tips and tricks - nodivbyzero
Hey hackers
Let&#x27;s share your javascript tips &amp; tricks. 
For example:<p>~~2 === Math.floor(2); &#x2F;&#x2F; true
======
leppr

        window.addEventListener("beforeunload", function () {
            alert("You just won our user lottery! Sign-up for a FREE iPad!");
            return false;
        }

------
lollipop25
Array(3).fill('ha').join('');

Array(16).fill('na').join(' ') + ' Batmaaan!!!';

