Mi9 code challenge written in node.js