0

I have an object like below.

var obj = {};
obj['key_1'] = ["2016-07-02","100","1"];
obj['key_2'] = ["2016-06-02","100","1"];

I want to sort the object by date in ascending order.

Can some one help me how to sort that object

Dinesh
  • 41
  • 1
  • 2
  • 9
  • 2
    Objects properties don't have an order. If it's important for the elements to be in a particular order use an array instead. Or iterate over `Object.keys(obj).sort(/*suitable sort function here*/)`. – nnnnnn Jul 03 '16 at 03:56
  • finding out how to write sort function... – Dinesh Jul 03 '16 at 19:02

0 Answers0