return {
father: {
name: "John",
wife: {
name: "Ann"
}
}
mother: {
name: "Ann",
husband: {
name: "John"
}
}
}
function marry(man, woman) {
woman.husband = man;
man.wife = woman;
return {
father: man,
mother: woman
}
}
let family = marry({
name: "John"
}, {
name: "Ann"
});
delete family.father;
delete family.mother.husband;
function marry(man, woman) {
woman.husband = man;
man.wife = woman;
return {
father: man,
mother: woman
}
}
let family = marry({
name: "John"
}, {
name: "Ann"
});
function marry(man, woman) {
woman = {
husband: {
name: "John"
}
}
man = {
wife: {
name: "Ann"
}
}
return {
father: {
wife: {
name: "Ann"
}
},
mother: {
husband: {
name: "John"
}
}
}
}
}
let family = marry({
name: "John"
}, {
name: "Ann"
});