<!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">
        let arr = [1,2,3,4,5,6,7,8,9,10];
        console.log(...arr);
        let o1 = {
            x : 1,
            y : 2
        };
        // 这个是语法错误
        // console.log(...o1);
 
        // 这个会生成一个新的对象
        console.log({...o1});
 
        // 主要用于对象的属性合并
        let o3 = {
            x : 1,
            y : 1
        };
        let o4 = {
            k : 1,
            f : 1
        };
        let o5 = {
            e : 1,
            w : 1
        };
 
        let o6 = {
            z : 1,
            b : 1
        };
 
        let o7 = {
            i : 1,
            p : 1
        };
 
        let o8 = {...o3,...o4,...o5,...o6,...o7};
        console.log(o8);
    </script>
</body>
</html>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.