As soon as your page is loaded into the browser, all javascript functions will be under the "window" object. For example, if you have,
function mytestfunciton() { console.log('This is a test'); }
In the console window, just try these
window.mytestfunciton();
You can also wrap them in a global variable, something like
var myapp = {}; myapp.add = function(a,b) { myapp.sumvalue = a + b; console.log('Sum Value:'+myapp.sumvalue); }; myapp.substract = function (a,b) { myapp.differencevalue = a - b; console.log('Difference Value:'+myapp.differencevalue); };
All your functions are now wrapped under the global variable myapp, and now you can call them from the console using something like
myapp.add(5,4);
or still use the global window object
window.myapp.add(5,4);
source share