JS implementation of a coin sorter application