How to make proper sorting of array?

// sorted map containing the normalized values
map.sort(function(a, b) {
return +(a.value > b.value) || +(a.value === b.value) - 1;
});

Get
id: 1
id: 2
id: 200
id: 3
id: 4

How to do a proper sorting to 200 was at the end ?
July 12th 19 at 17:18
2 answers
July 12th 19 at 17:20
Solution
map.sort(function(a, b) {
 return a.value - b.value;
});
July 12th 19 at 17:22
Error original that cast to numeric type (plus sign) stands for parenthesis, that is, it is already after comparison. And it is necessary to first led to the numbers, then everything else.

Find more questions by tags JavaScript