1. Don't use document.write() a lot
2. Check the client's ability to support the object (progressive) Instead of checking its client, test the object you want to use.
3. Access content in existing HTML instead of adding HTML through Js (separation of behavior layer and structure layer)
4. Do not use proprietary DOM objects (such as IE's document.all )
5. Put the script into a .js file instead of appearing everywhere in HTML.
6. Make improvements to a website that works well and doesn't require client-side programming, rather than adding scripts first and then adding non-script alternatives.
7. Keep the code independent and do not use global variables that may conflict with other scripts. (Object literal available)
8. Comment the code function, because you may be the one maintaining the code in the future.