https://peterkellner.net/2013/09/25/why-to-declare-javascript-variables-on-top-of-functions/