I'm a bit confused with JavaScript's delete operator.I am begginer in JS and I have a problem with removeName(person). Take the following piece of code:
let user = {};
user.name = "name";
export default function removeName (person){
delete user.name;
return new Object(person)
}
removeName(user);
console.log(user);
After this piece of code has been executed,I take as output {} but I want the below the function
removeName (person), accept the person object as a parameter, and
modifies the person object by deleting the property name field. THE
function will not return anything, it will modify the object directly.
I'm a bit confused because I think that i solve but I do not get the result I need.