I have array like this value = [250, 200, 300, 150, 300]
I use this code.
for (var j = 0; j < value.length - 1; j += 1)
{
if (value[j] > value[j + 1])
{
var temp = value[j + 1];
value[j + 1] = value[j];
value[j] = temp;
}
}
But,it's not working. It's results value = [200, 250, 150, 300, 300]
I want to acheive this without using inbuilt function.
value.sort()