Key Concepts

Review core concepts you need to learn to master this subject

Handlebars.compile()

const template = '<span>{{greetingMsg}}</span>'; const templateFunction = Handlebars.compile(template); const html = templateFunction({ greetingMsg: 'Greetings from the club!' }); console.log(html); // <span>Greetings from the club!</span>

Handlebar.compile() can be used to produce a templating function. A template string with expressions must be passed into Handlebar.compile(). That function then takes an object as an argument, interpolates the object’s values into the template expressions, and returns a completed HTML string.

Learn Handlebars
Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo