Untitled
unknown
plain_text
2 years ago
1.2 kB
3
Indexable
Never
const data = { "John": [ 1999, 12, 10 ], "Jane": [ 2001, 1, 20 ], "Jack": [ 1989, 7, 12 ], "Josh": [ 1960, 12, 4 ], "Arjun": [ "X", 9, 30 ], "Bhairav": [ 2000, 6, 12 ], "Bhim": [ 1996, 8, 14 ], "Binod": [ 1998, 1, 13 ], "Chandra": [ 1999, 9, 7 ], "Dipak": [ 1996, 7, 3 ], "Ganesh": [ 1997, 6, 7 ], "Hari": [ 1997, 7, 19 ], "Hira": [ 1998, 6, 28 ], "Kamal": [ 2001, 3, 4 ], "Karna": [ 1999, 8, 16 ], "Krishna": [ 1997, 1, 28 ], "Lakshman": [ 2000, 12, 3 ], "Lal": [ 1999, 12, 24 ], "Mana": [ 2000, 2, 18 ], "Mohan": [ 1999, 12, 20 ], "Narayan": [ 1999, 9, 23 ], "Prakash": [ 2001, 11, 21 ], "Prem": [ 2000, 10, 11 ] }; const fdA = Object.entries(data).sort((a,b) => { return (new Date(a[1]) - new Date(b[1])); }) .map((mapd) => { return { [mapd[0]]: [mapd[1]] } }); console.log(fdA);