1. Add the .js file to the project and mark as an embedded resource (See Build Action on properties tab).
2. Go into the AssemblyInfo.cs and add an entry. It will look like this:
[assembly: WebResource (“Namespace.File.js”,“text/javascript”)]
Where Namespace is the namespace for your web part project and file.js is the name of your file.
3. Inside OnPreRender, add the resource to the page. This is done with the following code:
Page.ClientScript.RegisterClientScriptResource(GetType(), “Namespace.File.js”);