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!

Brandon White
seal-mask
MOD
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Treehouse Moderator

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.