I have a variable and a function in a file hello.js as below:
I want to call the above function and access the variable from another file, say app.js, (both files in the same folder) var width = 500;
function reset() { //some code } How should I be doing it.
Thanks.
EDIT:
Actually,
I have the above variable and function inside another function, (I didn't mention earlier, I thought I will take hints and make it work):
Its like this:
var Engine = (function(global) { var width = 500; var canvas = doc.createElement('canvas'), canvas.width = 500; function reset() { //some code })(this); Now I am trying to access these function and variable, like below:
console.log(Engine.canvas.width); Engine.reset(); It doesn't recognize reset() and canvas.