Update main.js

Added to-go function.