I need a few clarifications on how Javascript deals with arrays and Date object.
Lets say daz is a date object. If I do this:
somevar=daz;
then "somevar" with be a pointer to daz, ie if I change somevar later daz will
change also. But If I do this:
somevar=new Date(daz);
somevar will a copy, not a pointer, of daz, ie if I change somevar later daz will
NOT change.
Right? Coming from C/C++ background I tend to think some new memory has been
allocated for "somevar". When will this memory be released? Can I do it manually
somehow if that is the case?
What about arrays? Lets say "bigar" is an array with many items. If I do this
somevar=bigar;
will somevar be a pointer to bigar and not a copy?
Lets say daz is a date object. If I do this:
somevar=daz;
then "somevar" with be a pointer to daz, ie if I change somevar later daz will
change also. But If I do this:
somevar=new Date(daz);
somevar will a copy, not a pointer, of daz, ie if I change somevar later daz will
NOT change.
Right? Coming from C/C++ background I tend to think some new memory has been
allocated for "somevar". When will this memory be released? Can I do it manually
somehow if that is the case?
What about arrays? Lets say "bigar" is an array with many items. If I do this
somevar=bigar;
will somevar be a pointer to bigar and not a copy?
Comment