People usually get confused between the copy() and apply() functions:
- apply(): It accepts a function and sets its scope to that of the object on which it has been invoked. It is a transformation function that can also be used to evaluate complex logic before returning. At the end, it just returns the same object with changes (if performed).
- copy(): The apply function is not thread-safe and mutates the object. The copy() function, on the other hand, returns a new object (without modifying the original object).