Getting Literal With ES6 Template Strings

added by DotNetKicks
1/26/2015 4:17:38 AM

2 Kicks, 195 Views

Strings in JavaScript have been historically limited, lacking the capabilities one might expect coming from languages like Python or Ruby. ES6 Template Strings (available in Chrome 41+), fundamentally change that. They introduce a way to define strings with domain-specific languages (DSLs), bringing better: String interpolation Embedded expressions Multiline strings without hacks String formatting String tagging for safe HTML escaping, localisation and more. Rather than stuffing yet another feature into Strings as we know them today, Template Strings introduce a completely different way of solving these problems.