This is the first of a two part introduction on how to write testable Javascript UI code. The first article presents a sample application that contains several common anti-patterns and how these can be refactored to be more testable. The complete refactor is presented in the second article along with info on how to add a unit test suite and make use of mocks. Front end development comes with a set