I have problem in order to sort an arry of object by two difrent keys. I want to sort this arry by price and if multi prices were same then sort them by time. I have some thing like this array:
var myArr = [
{"value":5 , "price"=10, "time":3},
{"value":1.5 , "price"=2, "time":2},
{"value":3 , "price"=5, "time":4},
{"value":1 , "price"=2, "time":1}
]
and after sort have to be something like this:
var myArr = [
{"value":1 , "price"=2, "time":1},
{"value":1.5 , "price"=2, "time":2},
{"value":3 , "price"=5, "time":4},
{"value":5 , "price"=10, "time":3}
]
I had tried many ways but I can't solve it since it's related to two keys at the same time.