<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
</style>
</head>
<body>
<script>
//ES6引入新的声明字符串的方式``(反引号) '' ""
//1.声明
let str=`我也是字符串`;
console.log(str,typeof str)
//2.内容中可以有换行符
let str1=`<ul>
<li>沈腾</li>
<li>玛丽</li>
</ul>`;
//3.变量拼接
let lovest='沈腾';
let out=`${lovest}是最搞笑的演员`;
console.log(out)
</script>
</body>
</html>
es6笔记5_模板字符串
最新推荐文章于 2024-07-27 15:20:55 发布