Since the object is created from an object literal in the function argument list, there are no references to the object outside the
set() function. The only reference is the local variable
value, and when the
set() function returns that variable goes away, so the object can be garbage collected. So can all its properties, since they also contain literals, not values that other variables have references to.
You didn't "turn the object into a string", you simply created a new string that contains a representation of the object. The string and the object are completely independent.