What is object cloning

Answers were Sorted based on User's Feedback



What is object cloning..

Answer / amar_java

Object Cloning is a process to copying all fields from one
object to a new object

Is This Answer Correct ?    5 Yes 0 No

What is object cloning..

Answer / anurag sharma

loning is a process to copying all fields from one
object

Is This Answer Correct ?    2 Yes 0 No

What is object cloning..

Answer / me

A bit of background information. Because the way memory
works (long story), an object consists of two things, the
reference which is basically a pointer, or a label that is
used to access the object, and the actual object data,
which is stored elsewhere (search Google for explanations
on memory stacks and heaps).

If you would simply copy an object, you would only copy the
reference. So what you end up with, are two references that
point to exactly the same data. When you change the
original object, the copy object gets changed as well, and
visa versa.

If that's not what you want, you have to clone the object,
which means you actually create a new object in memory,
that holds a copy of the data of the original object, and
you also create a new reference that points to this new
object.

When you then change some value in the original object, the
copy object stays unchanged.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More JavaScript Interview Questions

How many functions are there in javascript?

0 Answers  


What is whitespace in javascript?

0 Answers  


How do you declare in javascript?

0 Answers  


Enumerate the differences between Java and JavaScript?

0 Answers  


how can we generate alert message without referashing page in asp.net with language vb.net and script use in java script .means with out referash the page message in java alert

0 Answers   NIC,






How to create scale in P info

0 Answers   MAHINDRA,


Explain the term closure?

0 Answers  


How to count the number of element in an array using javascript?

0 Answers  


How fast can you learn coding?

0 Answers  


What is the difference between rootscope and scope?

0 Answers  


What is let keyword in typescript?

0 Answers  


How to detect the operating system on the client machine?

0 Answers  


Categories