JS Built-ins
StringString.rawintermediate

String.raw β€” compare with regular template literal

πŸ“– Usage Example
String.raw`Hello
World`   // β†’ 'Hello\nWorld'
String.raw`C:\Users\me`    // β†’ 'C:\Users\me'

Use String.raw as a tagged template to get the raw string form where backslash escapes are not processed.

String.raw vs Regular Template Literal

A regular template literal interprets \t as a tab. String.raw keeps it as two characters.

Challenge: Implement regularHasTab() that returns true when a regular template \t contains an actual tab character.

regularHasTab() // β†’ true
πŸ’‘ Hints (1)
  • β€’ Tab char code is 9. Backslash char code is 92.