å符串çåå¼å·
éè¦ç¨åº¦: 5
ä¸é¢çèæ¬ä¼è¾åºä»ä¹ï¼
let name = "Ilya";
alert( `hello ${1}` ); // ?
alert( `hello ${"name"}` ); // ?
alert( `hello ${name}` ); // ?
åå¼å·å°å
è£
å¨ ${...} ä¸ç表达å¼åµå
¥å°äºå符串ã
let name = "Ilya";
// 表达å¼ä¸ºæ°å 1
alert( `hello ${1}` ); // hello 1
// è¡¨è¾¾å¼æ¯ä¸ä¸ªå符串 "name"
alert( `hello ${"name"}` ); // hello name
// è¡¨è¾¾å¼æ¯ä¸ä¸ªåéï¼åµå
¥è¿å»äºã
alert( `hello ${name}` ); // hello Ilya