Implement function sort(items)
which sorts array items
by 2 parameters. After calling sort
all items which peopery active
equals true
should appear before ones with value false
. Apart of that items must be sorted in descending order by propery value
. Example:
const items = [{
active: false,
value: 3
}, {
active: false,
value: 1
}, {
active: true,
value: 2
}, {
active: false,
value: 2
}, {
active: true,
value: 1
}]
sort(items)