At Universal Containers, every team has its own way of copying JavaScript objects. The code
Snippet shows an implementation from one team:
Function Person() {
this.firstName = "John";
this.lastName = `Doe';
This.name =() => (
console.log(`Hello $(this.firstName) $(this.firstName)'); )}
Const john = new Person ();
Const dan = JSON.parse(JSON.stringify(john));
dan.firstName ='Dan';
dan.name();
What is the Output of the code execution?
- Hello Dan Doe
- Hello John DOe
- TypeError: dan.name is not a function
- TypeError: Assignment to constant variable.
Reveal Solution Next Question