"javascript" map swap key value site:stackoverflow.com code example
Example: swap key value object javascript
function swap(json){
var ret = {};
for(var key in json){
ret[json[key]] = key;
}
return ret;
}
function swap(json){
var ret = {};
for(var key in json){
ret[json[key]] = key;
}
return ret;
}