0

Input Data

 var data =  {
    "36905b7cb": "(2019-12-26 T 13H-39M-0S) Co-Testing",
    "cad5dd7ea": "(2019-12-05 T 16H-38M-9S) Diagnosis",
    "sad4217ea": "(2020-03-05 T 16H-38M-9S) Bio-Testing"
  }

Expected Output

var data =  {
    "sad4217ea": "(2020-03-05 T 16H-38M-9S) Bio-Testing"
    "36905b7cb": "(2019-12-26 T 13H-39M-0S) Co-Testing",
    "cad5dd7ea": "(2019-12-05 T 16H-38M-9S) Diagnosis"
  }

we have to arrange the data in the sorted based on date.Not the KEYS

Basil Bourque
  • 262,936
  • 84
  • 758
  • 1,028
Rahul Saini
  • 895
  • 1
  • 10
  • 23

1 Answers1

1

You can use the array util functions like reduce, sort. enter image description here

Anarno
  • 1,344
  • 5
  • 13
  • if data = { "787": "(2019-12-04 T 21H-17M-0S) Ortho 1", "456": "(2019-12-04 T 23H-58M-0S) Cardiologist Research", "123": "(2019-12-05 T 19H-0M-0S) Survey shoot 2", "36905b7cb": "(2019-12-26 T 13H-39M-0S) Co-Testing", "cad5dd7ea": "(2019-12-05 T 16H-38M-9S) Diagnosis", "sad4217ea": "(2020-03-05 T 16H-38M-9S) Bio-Testing"} Its not working on this input.Please help me – Rahul Saini Apr 25 '20 at 11:27