![]() ![]() Maybe one part of your code needs to hold on to the original object, but another part of your code needs to hold on to the new mutated form of the object. Things get dicey when you're talking about arrays of objects, because it's easy to just mutate an object contained within an array, but then that will lead to all sorts of wonky behavior. array.map returns a new array, for example. Some JS array functions do this for you automatically. ![]() In FP, rather than mutating your current array, you would pass it into some function, which makes a copy of it, appends or removes elements from it, and returns a brand new array. You asked a valid question that nobody really seems to be answering.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |