Summer Certification Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: force70

Salesforce Certified JavaScript Developer (JS-Dev-101) JavaScript-Developer-I Question # 24 Topic 3 Discussion

Salesforce Certified JavaScript Developer (JS-Dev-101) JavaScript-Developer-I Question # 24 Topic 3 Discussion

JavaScript-Developer-I Exam Topic 3 Question 24 Discussion:
Question #: 24
Topic #: 3

At Universal Containers, every team has its own way of copying JavaScript objects. The code snippet shows an implementation from one team:

01 function Person() {

02 this.firstName = " John " ;

03 this.lastName = " Doe " ;

04 this.name = () = > {

05 console.log( ' Hello ${this.firstName} ${this.lastName} ' );

06 }

07 }

08

09 const john = new Person();

10 const dan = JSON.parse(JSON.stringify(john)); // (intended deep copy)

11 dan.firstName = ' Dan ' ;

12 dan.name();

(Original line 10 is logically intended to be JSON.parse(JSON.stringify(john)) to perform a JSON clone.)

What is the output of the code execution?


A.

Hello John Doe


B.

Hello Dan Doe


C.

TypeError: dan.name is not a function


D.

Hello Dan


Get Premium JavaScript-Developer-I Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.