-
Notifications
You must be signed in to change notification settings - Fork 7
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();
foo.js
is loaded from the current working directory.
foo.js
sets a
and doStuff
on the top level scope so the above script can access them after load('foo.js')
is called.
The output is:
hello there,
stuff is now being done