Loading topic
``) instead of single or double quotes. ES2015 added it, and every modern browser and Node.js release supports it. This chapter covers the delimiter itself: what a backtick literal produces, how it compares t7 min read${} syntax, called a substitution, lets you place any JavaScript expression inside a string. The engine evaluates that expression and inserts the result. This chapter covers what may go inside ${}, when and in what order those 6 min read${} to insert a value. It also assumes you know how ordinary single- and double-quoted strings work, including the \n escape, and that you are comfortable with common array and string methods such as `spli7 min read${ starts a substitution. A backslash starts an escape sequence. When you need any of these to show up as plain text, you have to escape it. This chapter explains the escaping rules, the short7 min read${} can be numbers, arrays, objects, symbols, or anything else. Each value goes through a specific conversion step before it is joined into the result. Most of the time the output is what you expect. Sometimes it is not. Yo6 min read${} substitutions, that you know how interpolated values are converted to strings, and that you are comfortable with map, join, arrow functions, and the conditional (ternary) operator.6 min read...values), and the array methods reduce, map, and join. It also assumes you have read the earlier chapters on ${} interpolation and string conversion. So far, a template literal has always produced a string. Tagged templ6 min read\n and \t have already been turned into the characters they stand for. The raw version is the source text exactly as you typed it, with backslashes kept. 7 min readstrings and values arguments, how nested template literals work, and how interpolated values are converted to strings. You should also be comfortable with reduce, map, join, and basic classes. Here we use those pieces to7 min readstrings array of literal parts, a strings.raw array, and the evaluated substitutions as further arguments. You should also be comfortable with Map7 min readstrings and strings.raw arrays, and template object caching. This chapter covers one remaining edge case: what happens when a template contains a backslash sequence that JavaScript cannot interpret. In an untagged template literal this is a syntax 7 min read