1.利用展开运算符和解构完成以下
    [{
    name:”张三”,
    age:165,
    likes:[“发顺丰”,”jf”,”音乐9”,”10电影”],
    }]
    TOOCJY85~KVV0CELQY2OPZI.png

    1. <body>
    2. <script>
    3. var arr = [
    4. {
    5. name:"lisi",
    6. age:18,
    7. likes:["lol","足球"],
    8. alikes:["音乐","电影"],
    9. sex:"male"
    10. },
    11. {
    12. name:"王五",
    13. age:17,
    14. likes:["al","栏球"],
    15. alikes:["防抖","放到"],
    16. sex:"male"
    17. },
    18. {
    19. name:"张三",
    20. age:165,
    21. likes:["发顺丰","jf"],
    22. alikes:["音乐9","10电影"],
    23. sex:"male"
    24. }
    25. ]
    26. var res = [];
    27. for(var i=0;i<arr.length;i++){
    28. /* 解构 */
    29. var {name,age,likes,alikes} = arr[i];
    30. /* 展开 */
    31. likes.push(...alikes);
    32. /* 键和值相同只用写一个 */
    33. var obj ={
    34. name,
    35. age,
    36. likes
    37. }
    38. res.push(obj);
    39. }
    40. console.log(res)
    41. </script>
    42. </body>