2011/7/5 David Marrs <[email protected]>:
> Why do you have a 2nd arg in your lambda called undefined?
Because he might want to use the undefined value, and in case someone
in the global scope created a variable named undefined, then it can
cause trouble.
>
> Also, you will want to check for the existence of console.log before you
> call it, otherwise you will get a runtime error if firebug is switched off.
>
Maybe he uses IE9, Chrome, Opera or Safari, where it doesnt cause any trouble.

>
>
> ________________________________
> On 4 Jul 2011 20:30, Sam3k <[email protected]> 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/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>



-- 
Poetro

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to