语法 字符串模板 作用:可以在字符串中使用变量

    1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <title>Document</title>
    7. </head>
    8. <body>
    9. <script>
    10. /*
    11. 语法 字符串模板 作用:可以在字符串中使用变量
    12. */
    13. var str = 10;
    14. var b = "hello";
    15. console.log(str+b);//10hello
    16. var sum = `${str}hello`;
    17. console.log(sum)//10hello
    18. </script>
    19. </body>
    20. </html>