The following uses the Chrome Logging API. If the .group()
syntax is used in multiple templates, it will graphically organize the console logs from different templates into a hierarchical tree.
You can also see how to inspect the current data context, and how to stringify data.
Template.landingPage.getId = function(){
// using a group block to illustrate function scoping
console.group('coolFunction');
// inspect the current data object that landingPage is using
console.log(this);
// inspect a specific field of the locally scoped data object
console.log(JSON.stringify(this._id);
// close the function scope
console.groupEnd();
return this._id;
}