Share on facebook
Facebook
Share on twitter
Twitter

Understanding ECMAScript 6: Template Strings (#2)

Welcome to the second part of my series about ECMAScript 6! One of my favorite new web standards Microsoft Edge, the new browser rendering engine we’re creating at Microsoft, is the extensive support it offers for ECMAScript 6. So I wrote this series to walk you through some of the cool things you can do with ECMAScript 6 when writing large applications for the web. In the first installment, I covered Class and Inheritance. In this article, I’ll focus on template strings based on my personal experience creating embedded expressions. Resolving the Line Return Problem When working on babylon.js, I have to deal with shaders code which can be seen, for the sake of comprehension, like a big bunch of text (which looks like C). You can find an example here. The problem when dealing with long-sized text in JavaScript is the line return. How many times did you write this kind of thing? 1 2 3 4 5 6 7 var myTooLongString = “A long time ago, in a galaxy far,” + “far away….” + “It is a period of civil war.” + “Rebel spaceships, striking” + “from a hidden base, have won” + “their first victory against” + […]

X