Best Practices
From WebOS101
Contents |
Introduction
Here is some collected wisdom from the webOS development community.
Coding
- Use a tool like JSLint or JSure to check your code for typos and other potential coding mistakes
- Pick a coding standard that you are comfortable with and stick with it
- Learn Test Driven Development: Mojo™ Test Framework
Debugging
- To help with debugging, use Mojo.Log.info("%j", object) to log out the contents of an object. This is invaluable to use when getting responses from Mojo service requests to see what actually came back.
- When code isn't working write, wrap it in try/catch blocks. Not all errors will be logged automatically and sometimes errors occur in places you don't expect.

