JavaScript对数据按时间排序

			const  list = [
					{
			          T: 'TTTT',
			          Time: "2020-04-01 13:39:06"
			        },
			        {
			          T: 'vvvv',
			          Time: "2020-04-21 13:39:06"
			        },
			        {
			          T: 'ggggg',
			          Time: "2020-04-20 13:39:06"
			        },
			        {
			          T: 'fffff',
			          Time: "2020-04-20 15:39:06"
			        }
				]
			list.sort(function(a, b) {
			          return b.Time < a.Time ? -1 : 1
			 })
			console.log(list)

你可能感兴趣的:(JavaScript,javascript,前端)