I have a list of data objects to sort. I want to do something like
list.sort(function(item1, item2){ return item1.attr - item2.attr; })
to sort it based on a string attribute of the object. But I found that the minus (-) operator does not work for strings in JavaScript. So how do you do string comparison?