I look at the documentation for Immutable.js, in particular the following:
var map1 = Immutable.Map({a:1, b:2, c:3}); var clone = map1;
but I am confused by how simply assigning map1 to clone creates a clone, not a link?
Update: The docs document states "If an object is immutable, you can" copy "it by simply making a link to it instead of copying the entire object. Since the link is much smaller than the object itself, this will save memory and potentially increase execution speed for programs, which rely on copies (e.g. undo-stack).
I just tested this in jsbin, but the clone does === map1. I think that their use of the word "clone" in the documents is a little misleading.
source share