JavaScript Best Practices

In JavaScript, It is good coding practice to write all declaration at the top of script or Function.

Code :