Javascript Helpers

WordPress installs with a number of libraries/classes/plugins/etc that you can enqueue and use.

For base url specifically, or any vars in general you need to access from javascript, use the api php functions, then pass it to your javascript via wp_localize_script.