According to RFC 2045:
In general, the top-level media type is used to declare the general type of data, while the subtype specifies a specific format for that type of data. Thus, a media type of "image/xyz" is enough to tell a user agent that the data is an image, even if the user agent has no knowledge of the specific image format "xyz". Such information can be used, for example, to decide whether or not to show a user the raw data from an unrecognized subtype -- such an action might be reasonable for unrecognized subtypes of text, but not for unrecognized subtypes of image or audio. For this reason, registered subtypes of text, image, audio, and video should not contain embedded information that is really of a different type. Such compound formats should be represented using the "multipart" or "application" types.
Edit
So although JavaScript is indeed text, it's also a "registered subtype of text containing embedded information that is really of a different type", and therefore requires the application
top-level media type as defined by that RFC.
There are many application/...
MIME types which are not "applications" (executable binaries or code), eg: application/zip
(for Zip archives). So in this sense, the application
top-level media type is rather misleadingly named.