I have an expression in my underscore template like this:
'<%= a %> div <%= b %> is <%= a/b %>'
I would like to limit the number of decimal counts to a specific number. Is it possible in underscore.js?
Expected:
'10 div 3 is 3.33'
but actually I see:
'10 div 3 is 3.333333333'
Just use
Number.prototype.toFixed()
:<%= a %> div <%= b %> is <%= (a/b).toFixed(2) %>