Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Template literals (Template strings)

// Untagged, these create strings:
`string text`

`string text line 1
 string text line 2`

`string text ${expression} string text`

// Tagged, this calls the function "tagFunction" with the template as the
// first argument and substitution values as subsequent arguments:
tagFunction`string text ${expression} string text`
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #Template #literals
ADD COMMENT
Topic
Name
2+7 =