> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/val/prim/str/raw-string.md).

# raw string

[JS](/web/js.md) ⟩ [value](/web/js/val.md) ⟩ [primitive](/web/js/val/prim.md) ⟩ [String](/web/js/val/prim/str.md) ⟩ raw string

{% tabs %}
{% tab title="💈範例" %}

```javascript
// ⭐️ tag function (template function)
function raw(strings) {
    // ⭐️ first argument (`strings`) has a special `raw` property
    return strings.raw;
}

// ⭐️ tagged templates
raw`line 1 \n line 2`,          // [ 'line 1 \\n line 2' ] (`\n` not escaped)
raw`5 = \n ${2 + 3}!`,          // [ '5 = \\n ', '' ] (`\n` not escaped)

// ⭐️ raw strings
String.raw`5 = \n ${2 + 3}!`,   // '5 = \\n 5!'
String.raw`5 = \n \${2 + 3}!`,   // '5 = \\n \\${2 + 3}!'

// ⭐️ default template function
`5 = \n \${2 + 3}!`,            // 5 = (new line)
                                //  ${2 + 3}!
```

{% endtab %}

{% tab title="📘 手冊" %}

* [String.raw()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw) - [tag function](/web/js/val/prim/str/template-literal/tag-function.md) of [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
* ignores [escape sequences](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#using_special_characters_in_strings).
  {% endtab %}

{% tab title="👥 相關" %}

* [template literal](/web/js/val/prim/str/template-literal.md)
* [tag function](/web/js/val/prim/str/template-literal/tag-function.md)
  {% endtab %}
  {% endtabs %}
