JSFiddle - React, Tailwind, and code Playground

JavaScript

var _map = {
    'severity-normal': 0,
    'severity-minimal': 2,
    'severity-moderate': 3,
    'severity-severe': 4,
    'severity-highly-severe': 0
};


var top3 = [];
var _sortedMap = Object.keys(_map).sort(function(a,b){return _map[a]-_map[b]})
var _mapIndexes = Object.keys(_sortedMap);

for (var i=0; i<_mapIndexes.length; i++) {
	// i = the index of the _map key
  // _mapIndexes[i] = the index in the _map object
  // _map[_mapIndexes[i]] = the object
  
  if (i > 2) break;
  $('body').append('Key: '+_mapIndexes[i]+' Value: '+_sortedMap[_mapIndexes[i]]+'<br />')
  top3.push(_sortedMap[_mapIndexes[i]])
}