js 怎么改数组里每条对像的属性值?

如下:

只留下日期,时间去掉

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
</head>
<body>

  <script>
                var json = [
                        {
                            day: '2018-12-26 14:31:55'
                        },
                        {
                            day: '2018-12-27 14:31:55'
                        },
                        {
                            day: '2018-12-28 14:31:55'
                        },
                        {
                            day: '2019-12-29 14:31:55'
                        }
                    ];


                var dates = JSON.parse(JSON.stringify(json).replace(/day/g,"date"));
                console.log(dates);
                let date = [];
                for(let i in dates){
                    console.log(dates[i].date);
                }
  </script>
</body>
</html>

for(var i=0;i<json.length;i++){
json[i].day =json[i].day.split(" ")[0];
}; //一层层取就行了。

json = json.map(row => {
     return row.day.split(' ')[0]
})

https://quanyi.blog.csdn.net/article/details/103287788