Skip to content

load.js

Mark Watson edited this page Aug 19, 2016 · 5 revisions

Save the following to foo.js

a = "hello there,";
doStuff = function() {
    console.log("stuff is now being done");
}

Then the following script will read and execute this file inline:

load("foo.js");

console.log(a);
doStuff();

The output is:

hello there,
stuff is now being done

Clone this wiki locally