Utilising the reduce function in Javascript (Node.js) | Infernote