Tip: Standardize your comments

Tuesday, September 18, 2007 at 8:49 AM

Try using JSDoc format (similar to Javadoc) to standardize your comments: http://jsdoc.sourceforge.net/. You can then use the JSDoc tool to parse inline documentation and produce easily readable HTML documentation files. Here's an example:
* Predicts the winning team in a football game.
* @param {String} team1 The first team.
* @param {String} team2 The other team.
* @throws InvalidTeamException A team was not recognized.
* @throws RaidersException Are you kidding me?
* @returns The winning team.
* @type String
function PredictWinner(team1, team2) {
Have a tip you'd like to share? Send it to gd-developer AT google DOT com.

No comments: