WIP Implement functionality of JS for challenge 159 in C++