jskatas.org Continuously Learn JavaScript. Your Way.

Template strings: raw property

The raw property accesses the string as it was entered.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Use the raw property of tagged template strings like so s.raw

  • the raw property accesses the string as it was entered
  • raw can access the backslash of a line-break

String.raw as a static function

  • concats the raw strings
  • two raw-templates-string-backslashes equal two escaped backslashes
  • works on unicodes too

Links

Description of `raw` property of tagged template strings.
Describing the raw behavior.