<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
//ES6 2018 ES9版本的一些内容
let str = '2018-08-01';
let reg1 = /(d{4})-(d{2})-(d{2})/;
let reg2 = /(?<year>d{4})-(?<month>d{2})-(?<day>d{2})/;
//console.log(str.match(reg1));
//console.log(str.match(reg2).groups);
//直接输出groups对象 {year:2018,month:08,day:01}
//解构
let {year,month,day} = str.match(reg2).groups;//谷歌浏览器支持,
console.log(year,month,day);//2018 08 01
function fn(args) {
console.log(args);
return args[0].toUpperCase();
}
console.log(fn`test`); //标签函数
</script>
</head>
<body>
</body>
</html>