Question: I have a bunch of JavaScript files that I would like to include in the page, but I don't want to have to keep writing 

```
<script type="text/javascript" src="js/file.js"></script>

```

So is there a way to include all files in a directory (unknown size)? Can I do something like...

```
$.getScript("js/*.js");

```

... to get all the JavaScript files in the "js" directory? How can I do this using jQuery?

Answer: 
You can't do that in JavaScript, since JS is executed in the *browser*, not in the server, so it didn't know anything about directories or other server resources.

The best option is using a server side script like the one posted by jellyfishtree.
You can't do that in Javascript from the browser... If I were you, I would use something like [browserify](http://browserify.org/). Write your code using commonjs modules and then compile the javascript file into one.

In your html load the javascript file that you compiled.