Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

ParameterTypeMandatoryDescription
filenameString(tick)

The name of the file to include.

(question) The file must be in the same folder as the script that is including it, I think If it's in a different folder, include the relative path?

Return value

...

Oh the joy...

ValueTypeDescription
undefinedUndefined

The file was successfully included.

Note: undefined type-coerces to false in an if statement, which is a pity because false means...

falseBooleanThere was a problem including the file.

Note: The include() function traps any uncaught errors and writes them to the log files, then returns false. So you don't need to wrap this function in a "try ... catch" clause.

Example

Code Block
themeEclipse
languagejavascript
titleIncluding a file
linenumberstrue
include("foo.js"); // include foo.js