Let's consider a JSON data scenario:
olddata = {
userNname : "joeydash",
sex : "female",
email : "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ccada9fdfaaefcfcfd8cbfa1ada5a0e2a5a5b8a1e2adafe2a5a2">[email protected]</a>"
};
dataToEdit = {
name = "Mritunjoy Das",
sex = "male"
};
Are you aware of a JavaScript function that can achieve the following?
newData = doSomething(oldData,dataToEdit);
console.log(newData);
The expected output should be as follows:
{
userNname : "joeydash",
name : "Mritunjoy Das",
sex : "male",
email : "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="254440141347151514655648444c490b4c4c51480b44460b4c4b">[email protected]</a>"
}