I have that code:
arr = arr.sort(function (a, b) {
return a.time>b.time
})
Do I need to redefine arr or it is possible just to call sort function? like this:
arr.sort(function (a, b) {
return a.time>b.time
})
Will the sort and filter functions change the original array?
sortchanges the array. But the comparator function will work based on the return value of (+n, 0, -n) notboolean. Please change the comparator.