fac-14 / teamcoolerweek-2

To-do-list project
1 stars 1 forks source link

Array methods #34

Closed morkeltry closed 6 years ago

morkeltry commented 6 years ago

Very good practice to write 'pure' (ie non-mutating) functions dealing with your arrays :+1:

Some of the calls to cloneArrayOfObjects are redundant, since Array.concat() and Array.filter() return new arrays. Array.sort() doesn't, though.

Your code has the added bonus that it also clones, rather than copies reference to, each of the objects within the array. As these objects are not mutated by your functions, this is also unnecessary in this case.

However, what I've written all takes thinking about and planning and being very sure of your conclusions. If in doubt, clone everything!

sbinlondon commented 6 years ago

@njons @Zeanort @thejoefriel Good to read and keep in mind for future. Thanks @morkeltry!

thejoefriel commented 6 years ago

Amazing! I've refactored this.