JavaScript 中反引號 (`) 的用法 - Usage of the backtick character (`) in JavaScript

語言: CN / TW / HK

問題:

In JavaScript, a backtick seems to work the same as a single quote.在 JavaScript 中,反引號似乎與單引號的作用相同。 For instance, I can use a backtick to define a string like this:例如,我可以使用反引號來定義這樣的字符串:

var s = `abc`;

Is there a way in which the behavior of the backtick actually differs from that of a single quote?反引號的行為實際上與單引號的行為不同嗎?


† Note that among programmers, "backtick" is one name for what is more generally called the grave accent . † 請注意,在程序員中,“反引號”是更普遍稱為重音符號的名稱之一 Programmers also sometimes use the alternate names "backquote" and "backgrave".程序員有時也使用 備用名稱“反引號”和“背刻”。 Also, on Stack Overflow and elsewhere, other common spellings for "backtick" are "back-tick" and "back tick".此外,在 Stack Overflow和其他地方,“反引號”的其他常見拼寫是“反引號”和“反引號”。


解決方案:

參考一: http://stackoom.com/question/1s8KC
參考二: Usage of the backtick character (`) in JavaScript
「其他文章」