A closure, in its most basic form, looks like a function within a function. This is a powerful concept because all local variables inside of an inner function can be relatively accessed after that function has returned. I like to think of closures as a particular scope's "save state". Free variables contained within closures are remembered, even after that function is returned. Closures are great because they provide scope to your functions and help protect sensitive areas of code.
2. Object Literals
An object literal is a custom object defined in your code. Object literals are used in several ways, such as: containing multiple variables without polluting the global namespace, creating API objects, and passing neatly mapped data into a function. Here are examples of object literals in action:
Wrapping related data in an object literal grants scope to the data, as well as cleaning up the local namespace.
Creating API methods as part of an object literal grants specific scope to each method. This is highly advantageous due to each API's ability to be quarantined, version-ed, and debugged with ease.
Using object literals to pass data to a method is helpful when there are multiple arguments. Since object literals act as key-value stores, they can be passed in any order, allowing the API's method to scale without updating each callee instance ( just be sure to validate object existence on required keys ).
3. Namespaced Application Objects
4. Console and Developer Tools
Not all tests are created equal. It is very important to make sure your tests cover the right functionality. Different project types call for different testing methodologies. In an event-driven application, any function that could be used from more than one context should be abstracted from it’s origin into a helper or API method. Test driving these methods help insure stability from an external context, but more importantly, it helps force the developer to write scalable and well structured code.
If you want to try TDD but don't know where to get started, I would reccomend playing with Jasmine, QUnit, or PhantomJS:
Edit: Added PhantomJS – thanks Alex!