JSFiddle - React, Tailwind, and code Playground

by Graham Fairweather

JavaScript

function getNamesSmallestToLargestByValue(thisObj) {
    return Object.keys(obj).map(function (name) {
        return [name, this[name]];
    }, thisObj).sort(function (x, y) {
        return x[1] - y[1];
    }).map(function (element) {
        return element.shift();
    });
}

var obj = {
        'a': 11,
        'b': 23,
        'c': 8
    };

console.log(getNamesSmallestToLargestByValue(obj));