Helpers

Where logic actually lives. Register them in JS:

Handlebars.registerHelper('uppercase', function(str) {
  return str.toUpperCase();
});
  • Helpers can take positional args + a hash (key-value options).
  • Block helpers get options.fn(this) to render their block content and options.inverse(this) for the {{else}} branch.
  • Built-in helpers worth knowing:
    • {{lookup obj key}} for dynamic property access,
    • {{log this}} for debugging.