Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Foundations Variables Null and Undefined

Roy Huang
Roy Huang
4,367 Points

'console' was used before it was defined

I am learning J.S. using Brackets.

When I was trying to use console.log, it tells my there is a JSLint Problem, 'console' was used before it was defined.

I don't know what could cause this happen and how to solve it, please help.

Thank you .

3 Answers

Console.log() is not actually defined in standard Javascript, so JSLint has no idea what you're talking about – it thinks you're trying to call a method ".log()" from an object "console" that wasn't defined yet. However, when you run your script in the browser, you should get output in the DevTools console.

Hope that helps.

Roy Huang
Roy Huang
4,367 Points

Hello Matthew, thank you for your prompt and clear answer.

If I understand clearly, I don' t have to worry about about the warning, and it will just display normally if I run it in my browser?

Yep! You can safely ignore it in this case.

Justin Walker
Justin Walker
934 Points

The page below goes into more detail and how to ignore the warning while in development.

http://stackoverflow.com/questions/40816924/jslint-throwing-error-when-using-console-log