I have an array and I am sorting it but I need to sort everything except one element of my array.
My array is:
var Comparison = [
{key: \"None\", val
Just add a check at the beginning. If it's the none object then move it to the front without performing the checks.
var Comparison_sort = this.Comparison.sort(function (a, b) {
if (a.key == "None" && a.value == "None")
return -1;
if (b.key == "None" && b.value == "None")
return 1;
if (a.key < b.key)
return -1;
if (a.key > b.key)
return 1;
return 0;
});