<!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>
</head>
<body></body>
<script>
// 展开语法...
let hd = [1, 2, 3];
console.log([...hd]);
// 在右边,就是放
let [a, b] = [...hd];
console.log(a, b);
// 在左边,就是收
// let [...cms] = [1, 2, 3, 4];
// let cms = [1, 2, 3, 4] 这么写也是跟上面一样额
let [c, ...cms] = [1, 2, 3, 4, 5];
console.log(cms);
</script>
</html>
js 展开语法
最新推荐文章于 2023-05-16 23:07:31 发布