Question: I want to sort an array containing numerical values. I know the original logic but it is not working for me. However I want to stop sorting for the similar numerical values in an array.

Answer: 
By default, JavaScript will convert the numbers in the array to strings and sort by their unicode code points so a comparison function needs to be supplied with consecutive array elements as the arguments:

For more clarity your comparison function should work as follows: 

```
function descending(a, b) { 
  if ( a.avg_fantasy_points > b.avg_fantasy_points ) {
    // Sort a to have a higher index than b
    return 1;
  }
  else if ( a.avg_fantasy_points < b.avg_fantasy_points ) {
    // Sort a to have a lower index than b
    return -1;
  }
  else {
    // Do nothing
    return 0;
  }
});

```

This will compare and sort by the `avg_fantasy_points` on each object.

It can simply be written as:

```
function descending (a,b) {
   return a.avg_fantasy_points - b.avg_fantasy_points;
});

```
```
var numbers = [40, 100, 1, 5, 25, 10];
numbers.sort(function(a, b){return a-b});

```