For example, instead of using var x = 10; use var numberOfStudents = 10;
Follow coding conventions
Use functions for code reusability
Functions are an important part of writing reusable code. Functions are blocks of code that can be called multiple times from different parts of your program. Using functions helps you avoid writing redundant code and makes your code more efficient and easier to maintain.
Avoid global variables
Global variables are variables that are available throughout your code. While they can be useful in some cases, it is generally best to avoid using them as much as possible. Global variables can be easily overwritten, leading to unexpected results. Instead, use local variables and functions to limit the scope of your variables.
Use comments to explain your code
Use strict mode
Use const and let instead of var