Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is object cloning

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What does parse Query String return in javascript?

907


What is argument objects in javascript?

888


How to have the status line update when the mouse goes over a link (the support of the status line is sporadic)?

898


Write a program to exaplain the deferred scripts using event handlers in javascript.

845


What is lazy loading java?

830


What is the difference between local storage & session storage?

852


How to convert javascript date to iso standard?

972


Are java and javascript same?

903


What is an immediately-invoked function expression?

850


Explain export & import in javascript?

982


Can I learn javascript without knowing java?

848


Is javascript enabled on chrome?

854


Some XYZ company is arranging for online aptitude tests. Draw detailed E-R diagram for the same..

2054


How to call a function in every x seconds in javascript?

871


What are JavaScript Cookies?

872