let userName = { name: "John Doe" };
let userSex = { sex: "Male" };
let user = { ...userName, ...userSex };
console.log(user); // { name: "John Doe", sex: "Male" }
// Note: In a situation where one key has another property,
// the last property overrides the first instance:
let userName = { name: "John Doe" };
let userSex = { sex: "Female", name: "Jane Doe" };
let user = { ...userName, ...userSex }; // { name: "Jane Doe", sex: "Female" }