79413928

Date: 2025-02-05 07:25:05
Score: 0.5
Natty:
Report link

You can achieve your desired output by sorting your object based on the length of its array values by converting it to an array of key-value pairs.

let sortedArray = Object.entries(my_array)

sortedArray.sort((a, b) => a[1].length - b[1].length);

let sortedObject = Object.fromEntries(sortedArray);
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Raja Jahanzaib