Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Basic and Multiple Line Strings

Template literals have no support in IE. So if/when should they be used?

I've noticed that template literals, while awesome, have NO support in IE. That's still a large market share to ignore. For this reason, when, if ever, would one want to use template literals at this time as a web dev?

Thanks, guys!

2 Answers

Steven Parker
Steven Parker
218,692 Points

You might want to delay adopting any new technology until it is well supported.

If you're preparing content for the world market, you'll have to be among the last to adopt the newer technologies. Just keep an eye on resources like Can I Use? for when things change.

On the other hand, developers who's consumer base are in a corporate intranet, and where all the browsers can handle the current technology, are probably using these technologies already.

Thanks, Steven!

Rich Donnellan
Rich Donnellan
25,768 Points

It's worth noting that using a tool such as Babel can compile your "future" code to supported ES5 syntax. You can see an example here: https://babeljs.io/docs/plugins/transform-es2015-template-literals/

Nice! Thank you for pointing that out.

Abraham Juliot
Abraham Juliot
47,341 Points

Just be aware that in template literals, babel as well as typescript will sometimes compile every tab space to tab characters, which makes the compiled string unreadable. Personally, I prefer using an array and the join method for string templates. It looks fairly nice and the output remains readable.