@manhnguyenv

Welcome to my blog!

Web Performance Tips: 10 JavaScript Best Practices

July 21, 2017 13:30

Best Practices

To highlight the presentation, I have talked about the following JavaScript best practices tips:

  1. Put stylesheets at the top (css)
  2. Move scripts to the bottom (javascript)
  3. Provide a clean separation of content, CSS, and JavaScript
  4. De-reference unused objects
  5. Think Asynchronous
  6. Working with Objects
  7. Defer Loading Resources
  8. Use JSLint -- Code Quality Tool
  9. Reduce the size of JavaScript file
    • gzip
  10. General JavaScript Coding Best Practices
    • Use === Instead of ==
    • Eval = Bad
    • Don’t Use Short-Hand
    • Reduce Globals: Namespace
    • Don't Pass a String to "SetInterval" or "SetTimeOut"
    • Use {} Instead of New Object()
    • Use [] Instead of New Array()

Categories

Recent posts