Essentials, best practices and Pattern to write good js code