How to Use UnderscoreJS Templates

I am using Underscore.js from long time, it’s a JavaScript library that provides useful functional programming helpers without extending any built-in objects. I recently came across it’s templating capabilities. Underscore provides _.template() function to dynamically build markup from a template and some data(JavaScript objects).

Here is the syntax:  _.template(templateString, [settings])

_.template() compiles JavaScript templates into functions that can be evaluated for rendering complicated bits of HTML from JSON data sources.