It's better to set the two previous references to empty arrays, and wrap the code below - `return` statement excluded - in the `else`. This way, if one day someone wants to change the name of the keys of the returned object (this is what makes the interface), he will have to do it only at one place, it's less error prone.