代码语言:javascript复制
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
// 1.字符串切割
let arr=[1,3,5];
let a=arr.join("|");
console.log(a);
let b=a.split("|");
console.log(b);
// 2.判断是否以指定字符串开头 ES6
let str = "http://www.it666.com";
let w=str.startsWith("http");
console.log(w);
// 3.判断是否以指定字符串结尾 ES6
let str1= "lnj.jpg";
let r=str1.endsWith("png");
console.log(r);
// 4.字符串模板 ES6
let vv=`www.it666.com`;
console.log(vv);
let cc=`<ul>
<li>aaa</li><li>bbb</li>
<li>ccc</li>
</ul>`;
console.log(cc);
let name = "lnj";
let age = 34;
let ff=`${name},${age}`;
console.log(ff);
</script>
</body>
</html>