I think 'Code Readability' is the only important point here. And code is definitely more readable if variables are declared closer to where they are used.
But, sometimes, in order to prevent 'errors' for new programmers transitioning between languages, a particular style of coding method may be adopted. For example, JavaScript has functional scoping vs Java which has block scoping. A Java programmer can run into issues in JavaScript if she is unaware of JavaScript's functional scoping. Therefore, in case of JavaScript, in order to avoid potential bugs, it is just recommended to declare everything at the beginning of a function/method.
Like I mentioned above, 'Performace' shouldn't be a concern. But, if you choose to declare variables closer to where they are used, it could help in reducing declaration and initialization costs of variables.