swap key value pairs in an object javascript 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;
}