I have an object that is defined in another file that I cannot edit. I need to call a function that was defined within it, but was not set as a method. My test does not work since callMe does not exist in my scope.
// Example
function ObjectCreator()
{
this.name = "I am an object";
var callMe = function()
{
console.log("You did it");
}
this.DontCallMe = function()
{
console.log("You should not have called me");
callMe();
}
return this;
}
My File
// My attempt
var foo = new ObjectCreator();
foo.test = function()
{
// throws not defined error
callMe();
};
foo.test();
How can I call callMe() without editing the original file to make it public?