Is it possible to update only the existing property values of an object without adding new properties from another object?
Here is my example.
form = {name: '',email: ''};
data = {name: 'sample', email: 'sample@gmail.com', datofbirth: '6/2/1990' };
form = {...form, ...data};
console.log(form);
Result:
{"name":"sample","email":"sample@gmail.com","datofbirth":"6/2/1990"}
Expected Result:
{"name":"sample","email":"sample@gmail.com"}
I dont want the dateofbirth or any new property added on my form object.