JavaScript implementation of Five or More game