JavaScript String raw() method
returns the raw string form of a template literal

String.raw() static method returns the raw string form of a template literal.

syntax

String.raw`templateString`

templateString A template literal, optionally with substitutions ${...}

String.raw() method enables access to the raw string from a template literal.

String.raw() method useful when dealing with special characters that should not be escaped.

The string does not process escape characters: \b, \f, \n, \r, \t, \v, \', \", \

Anything interpolated into the string will be processed: `${...}`

String.raw`Hello\n\t-${1+2+3+4+5+6}` returns 'Hello\\n\\t-21'

TypeError thrown if the first argument doesn't have a raw property, or the raw property is undefined or null ↴

String.raw({}); returns ↴

TypeError: Cannot convert undefined or null to object

syntax description
return the raw string form of template literal
String.raw`templateString`