I have an extremely large JSON object structured like this:
{A : 1, B : 2, C : 3, D : 4}
I need a function that can swap the values with
Try
let swap = (o,r={})=> Object.keys(o).map(x=>r[o[x]]=x)&&r;
let obj = {A : 1, B : 2, C : 3, D : 4}; let swap = (o,r={})=> Object.keys(o).map(x=>r[o[x]]=x)&&r; console.log(swap(obj));