SOURCE

function invert(obj){
      for (let k in obj) {
        let name = obj[k];
        obj[name] = k;
        delete obj[k];
      }
      return obj;
}

const obj = {
    first: "fs",
    second: "fw"
}

let obj2 = invert(obj)
console.log(obj2.fs)
console.log(obj.fw)
console 命令行工具 X clear

                    
>
console