Try adding these four lines immediately before the debug.log() call inside the wrapper function (the one that fails):
console.log( _debug ); console.log( window.debug ); console.log( debug ); console.log( debug.toString() ); That may lead to this interesting idea... What if you change these lines: var _debug = new Debugger(); window.debug = _debug; to: debug = new Debugger(); -Mike On Mon, Jul 4, 2011 at 12:42 PM, Sam3k <srolda...@gmail.com> wrote: > Environment: > FireFox 5 > Firebug 1.7.3 > > On Jul 4, 3:30 pm, Sam3k <srolda...@gmail.com> wrote: > > Why does the following script works within the application code but it > > doesn't when I type it in the firebug console. It throws the following > > error: > > > > TypeError: debug.log is not a function > > > > My goal with this script is to make an object from where I can log > > things to the console, store javascript speed performance in different > > areas, and turn off if no cookie is set. > > > > file: Debugger.js > > (function (window, undefined) { > > > > function Debugger() { > > this.test = 'xxxxxx'; > > } > > > > Debugger.prototype.log = function(data) { > > console.log(data); > > } > > > > var _debug = new Debugger(); > > > > window.debug = _debug; > > > > debug.log('DEFE"DEFEF'); // this works > > > > })(window); > > > > debug.log('OUTSIDE DKEGFYG'); // this works too > > > > Also any constructive feedback is greatly appreciate it. > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/jsmentors@jsmentors.com/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/jsmentors@googlegroups.com/ > > To unsubscribe from this group, send email to > jsmentors+unsubscr...@googlegroups.com > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com