function compare(property) { return function (a, b) { var value1 = new Date(a[property]); var value2 = new Date(b[property]); return value2 - value1 ; } } //进行排序序列化为字符串保存 localStorage.bookList = JSON.stringify(bookList.sort(compare('time'))); 使用sort…