JS Built-ins
StringString.rawbeginner

String.raw β€” basic tagged template

πŸ“– 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

String.raw is a tagged template literal function. It returns the raw string form where backslash escape sequences are NOT processed.

Challenge: Implement getRawPath() that uses String.raw to return the string C:\\Users\\name without double-escaping.

getRawPath() // β†’ 'C:\Users\name'
πŸ’‘ Hints (1)
  • β€’ In `String.raw`, a single `\` in the template source is preserved as `\` in the output.