JavaScript Code Smells

  • HTML in your JavaScript
    • Jquery template plugin
    • mustache.js
    • underscore.js
  • Changing Style Information in JavaScript
  • Duplication of Existing jQuery methods
  • Repetition that JQuery lets you avoid
    • Store selection in a var
    • Use chain and setter function
  • Deeply nested anonymous functions
    • Isolate functionality into an object (object literal) with methods
  • Over-testing for truthiness
  • Repetitive logic blocks
    • only repeat what needs repeating.
  • Passing a lot of arguments to a function
    • Use object instead

Reference

results matching ""

    No results matching ""