June 2016
Beginner to intermediate
376 pages
8h 23m
English
The previous example showed two of the new features introduced with ES-2015, multiline and template strings. The feature is meant to simplify our life while creating text strings.
The existing string representations use single quotes and double quotes. Template strings are delimited with the backtick character that's also known as the grave accent (or, in French, accent grave):
`template string text`
Before ES-2015, one way to implement a multiline string was this construct:
["<html><head><title>Hello, world!</title></head>",
"<body><h1>Hello, world!</h1>",
"<p><a href='/osinfo'>OS Info</a></p>",
"</body></html>"]
.join('\n')Yes, this is the code used in the same example in previous versions of this book. This ...
Read now
Unlock full access