I usually put all variables on the top of the function except for-loop. Even though variable in the for-loop gets hoisted to the top anyway, the placement tells the reader that they are not suppose to reuse these variables outside of the for-loop, and if they do, I will know right-a-way that's a bug. If these variables are placed at the top,  and gets reused outside of the for-loop. I have no idea if that's a bug or its author's intend to reuse the same variables.