Skip to content

Commit 5c3e9ac

Browse files
committed
Translation zh-TW answer 72
1 parent e0899bb commit 5c3e9ac

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

zh-TW/README_zh-TW.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,4 +2245,39 @@ console.log(/* 2 */); // JavaScript 也愛你 ❤️
22452245
</p>
22462246
</details>
22472247

2248+
---
2249+
2250+
###### 72. 將會輸出什麽內容?
2251+
2252+
```javascript
2253+
console.log(String.raw`Hello\nworld`);
2254+
```
2255+
2256+
- A: `Hello world!`
2257+
- B: `Hello` <br />&nbsp; &nbsp; &nbsp;`world`
2258+
- C: `Hello\nworld`
2259+
- D: `Hello\n` <br /> &nbsp; &nbsp; &nbsp;`world`
2260+
2261+
<details><summary><b>答案</b></summary>
2262+
<p>
2263+
2264+
#### 答案: C
2265+
2266+
`String.raw`會回傳一個字串,其中轉義符(`/n`, `/v`, `/t`等)被忽略! 反斜線可能是一個問題,因為你可能會有這樣的結果。
2267+
2268+
`const path = "C:\Documents\Projects\table.html"`
2269+
2270+
將會得到:
2271+
2272+
`C:DocumentsProjects able.html`
2273+
2274+
如果使用`String.raw`,它將直接忽略轉譯並輸出。
2275+
2276+
`C:\Documents\Projects\table.html`
2277+
2278+
在這種情況下,字串會以 "Hello\nworld",被記錄下來。
2279+
2280+
</p>
2281+
</details>
2282+
22482283
---

0 commit comments

Comments
 (0)