In the code below, we want to clone an object (with its current state) and use the clone without altering the original
object.
"use strict";
function Counter () {
}
Counter.prototype = {
_value: 0,
next: function () {
return this._value++;
}
};
var original = new Counter();
assert(original.next() === 0);
assert(original.next() === 1);
var clone = your_solution_here;
assert(clone.next() === 2);
assert(clone.next() === 3);
assert(original.next() === 2);