Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Reference error: 'console' is not defined
- StarscreamClone
-
Scratcher
1000+ posts
Reference error: 'console' is not defined
Alright, so when I type this into my JS compiler in my iPad application or on the compiler in Khan Academy, this error pops up. Is there a reason it's doing this when it will work fine in the Codecademy one?
Thank you,
Isaac
Thank you,
Isaac
- djdolphin
-
Scratcher
1000+ posts
Reference error: 'console' is not defined
Alright, so when I type this into my JS compiler in my iPad application or on the compiler in Khan Academy, this error pops up. Is there a reason it's doing this when it will work fine in the Codecademy one?What exactly do you mean by ‘this’?
Thank you,
Isaac
- scimonster
-
Scratcher
1000+ posts
Reference error: 'console' is not defined
The iPad probably doesn't support the console. 
You should probably define it at the top of your code as a fallback:
This won't break console.log() statements.

You should probably define it at the top of your code as a fallback:
var console = console || {log: function(){}};- StarscreamClone
-
Scratcher
1000+ posts
Reference error: 'console' is not defined
The iPad probably doesn't support the console.I would have thought that, too, but it was built into the application, believe it or not. There are tons of 'em.
You should probably define it at the top of your code as a fallback:This won't break console.log() statements.var console = console || {log: function(){}};
Anyway, thank you so much. I appreciate it.

- Discussion Forums
- » Advanced Topics
-
» Reference error: 'console' is not defined


