Here's a simple example to illustrate copy by reference with objects in JavaScript.
These copies are not deep copies, meaning that if the original object contains nested objects,
changes to the nested objects will still be reflected in both the original and copied objects.
// Neel.B
const employee = {
name : "Neel",
email : "neelbhardwaj97@gmail.com"
}
const newEmployee = employee
newEmployee.name = "mani"
console.log(employee.name) // output : mani
© www.thecoderjob.com. All Rights Reserved. Designed by HTML Codex