Simple functions for object arrays/lists in JavaScript