JSFiddle - React, Tailwind, and code Playground
HTML
<select></select>
JavaScript
var data = {
675: "B",
491: "C",
520: "D",
679: "F",
538: "G",
681: "E",
490: "A"
};
var x = [];
$.each(data, function(key, value) {
x.push($("<option></option>").attr("value", key).text(value));
});
x.sort(function(a,b){
if($(a).text() == $(b).text()){
return 0;
}
return $(a).text() < $(b).text() ? -1:1;
});
$('select').append(x);
console.log($('select'));