# Custom function comparison returns incorrect value, but only when the lower value is between 3 and 9

I am writing a custom function for google sheets to give me the win/loss values of volleyball matches. To do that I get the range of the games and just say if the current range value for game 1 is greater than the other range value for game 1, increase to the wins column. But for some reason, when the score for the losing team is between 3 and 9 (inclusive) it will say that they have the higher score (compared to 25).

``````function GETNUMWINS(currentRange, otherRange) {
var wins = 0;
var numGames = currentRange.length;

for(let i = 0; i < numGames; i++){
if(currentRange[i] > otherRange[i]){
wins++;
}
}
return wins;
}
``````

For example, a match of

Team A Team B
25 9
25 15

will result in that function returning 1 win for each team.

### >Solution :

Then it’s probably considering the numbers as strings, subsequently considering "in alphabetical order" 3 greater than 25

Try:

``````(currentRange[i]*1 > otherRange[i]*1)
``````