Excuse me, how is this written in JS?

const key = "name";
let obj;

const res = (obj = {}, obj[key] = "John", obj);
console.log(res); // {name: "John"}

I saw it in one place, and I don"t understand it. I"d like to ask how to write it

.
Mar.06,2021

comma operator.
first calculates the left Operand, then calculates the right Operand, and finally returns the value of the right Operand.

Menu