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 Basics Hello, JavaScript! Debug JavaScript in the Console

Jo-Shan Lee
PLUS
Jo-Shan Lee
Courses Plus Student 116 Points

I keep getting ['alert' is not defined] error on Atom, but my code works.

I keep getting ['alert' is not defined] error on Atom, but my code works in the browser.

Can anyone tell me what this means? What do I do with this warning and how do i fix it?

Thank you so much!

2 Answers

Jo-Shan Lee
PLUS
Jo-Shan Lee
Courses Plus Student 116 Points

Hi Brandon, thank you so much for your answer! 🙏

This is what I'm trying to do: alert("Hello, World!"); console.log("hello from console."); alert("Thanks for visiting!"); document.write("<h1>Welcome to my space!</h1>");

The thing is, it worked previously. But for some reason I started getting the "invalid regular expression flags" warning for every file I opened including a new one. Someone advised to re-install Atom, so I did and now it's a different kind of error LOL 🤦‍♀️

My apologies if my questions or concerns seem dumb. I'm a JS newbie :D

Thanks, again!

Hi Jo-Shan,

The 'is not defined' message typically means that you're trying to access the value of an undeclared variable.

For example:

const name = "Brandon"

print(firstName) // <= this statement would cause an error because I have yet to declare a variable called firstName

If you could provide a link to your code so that I can run it myself, I might be able to help you figure out what specifically is leading to your error/warning.