With help of @FelixKling's suggestion, I was able to sort it using a simple block of code. Posting it since it might be helpful for someone else.
tempCube.sort(function(a, b) {
var valueA, valueB;
valueA = a.measures.Cost;
valueB = b.measures.Cost;
if (valueA < valueB) {
return -1;
}
else if (valueA > valueB) {
return 1;
}
return 0;
});