How can I create a javascript library in a separate file and "include" it in another?

Posted by Jordan L. Walbesser on Stack Overflow See other posts from Stack Overflow or by Jordan L. Walbesser
Published on 2009-05-29T21:28:37Z Indexed on 2010/03/14 3:15 UTC
Read the original article Hit count: 360

First, a caveat. The main script is not run in a webpage. I will be running the .js file in Windows using Windows Script Host.

The problem: I would like to create a javascript "library" containing a number of objects, each with a number of functions. I expect this library will get rather large with time and would like to keep it in a separate javascript file (let's call it Library.js). I would like to access the objects from Library.js from another script (let's call this one User.js).

In essence, I am looking for something similar to the C/C++ "include" paradigm.

Is there anyway to implement this in javascript? (Remember, this is not web-based)

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about wsh