Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Is it a good practice to place all declarations at the top in JavaScript?
Yes, it is a good practice to place all the JavaScript declarations at the top. Let’s see an example −
Example
JavaScript String match() Method
The following are the valid reasons −
- Gives a single place to check for all the variables.
- Helps in avoiding global variables
- Re-declarations are avoided.
- The code is easy to read for others as well.
Advertisements
