Save the following to foo.js
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.
a
doStuff
load('foo.js')
The output is:
hello there, stuff is now being done
There was an error while loading. Please reload this page.
Home
Examples
FAQ
Chrome Setup