To clone an object in jQuery:
var vi.nextSegment = jQuery.extend({}, vi.details);
NOTE. The above information is a shallow copy: any nested objects or arrays will be copied by reference - this means that any changes you make to vi.nextSegment.obj[prop] will be reflected in vi.details.obj[prop] . If you want a completely new object that is completely separate from the original, you need to make a deep copy (pass true as the first parameter):
var vi.nextSegment = jQuery.extend(true, {}, vi.details);
To learn more about the extension, see here.
Mike Lewis Mar 19 '11 at 20:21 2011-03-19 20:21
source share