Literals/String: Difference between revisions

Content added Content deleted
m (Moved Wren entry into correct alphabetical order.)
(→‎{{header|JavaScript}}: Added template literals)
Line 1,292: Line 1,292:


ES6 introduces Unicode code point escapes such as <pre>'\u{2F804}'</pre>allowing direct escaping of code points up to 0x10FFFF.
ES6 introduces Unicode code point escapes such as <pre>'\u{2F804}'</pre>allowing direct escaping of code points up to 0x10FFFF.


ES6 also introduces template literals, which are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them. Template literals are enclosed by the backtick (<code>` `</code>) (grave accent) character instead of double or single quotes.

<lang JavaScript>const multiLine = `string text line 1
string text line 2`
const expression = `expressions are also supported, using \$\{\}: ${multiLine}`

console.log(expression)</lang>
{{out}}
<pre>
expressions are also supported, using ${}: string text line 1
string text line 2
</pre>


=={{header|jq}}==
=={{header|jq}}==