Upload Javascript Files to Wordpress

Let's say you want to add a javascript file to your wordpress website. If you log in to the admin dashboard you'll quickly realize that there is no option that let's you upload a javascript file. Now you're left with the option where you have to manually upload (via ftp or file manager) the js file into a folder in the server. This is technically the right way to solve this. However, there may be situations when you are unable to do that. Luckily there is a workaround to this.

Log in to your wordpress admin dashboard. On the navigation menu on your left, you'll see a Media menu. Under this menu there are two options: 1. Library and 2. Add new. Click on Add new. Select the javascript file from your computer and upload.

When your upload is complete, click on Library under the Media menu. This gives you a list of all files that you have uploaded to your website. On the top of the list should be your js file that you uploaded earlier. You will also notice that other media files (image files) are represented by their thumbnails while your js file is represented by some default wordpress icon. Click on this icon. You'll be taken to the Edit Media page. You don't need to edit anything but on the right you should see File URL. Under this there is a url that points to the js file. Use this link on your script tags. Thats all! Done!