String raw()
The String.raw() static method interpolates template literal substitutions, but ignores escape sequences. It is the tag function for template literals.
Overview
The String.raw() static method interpolates template literal substitutions, but ignores escape sequences. It is the tag function for template literals.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 41 | 12 | 34 | 9 | 41 | 9 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Syntax
JAVASCRIPT
String.raw`Hello\
World`;
// 'Hello\\
World' (no line break)
// Windows path
String.raw`C:\Users\Admin\Desktop`;
// 'C:\\Users\\Admin\\Desktop' Live demo
escape-pcharacter. Disabledization
\n(change row) etc. specialcharacter that. character and output..
PreviewFullscreen
Use cases
Using String raw()
The String.raw() static method interpolates template literal substitutions, but ignores escape sequences. It is the tag function for template literals.
Cautions
- No specific concerns. Stable across all major browsers.
Accessibility
- When updating the DOM dynamically, announce important changes to assistive technology with aria-live regions.
Related links
Powered by web-features